1. URL全体を文字列に設定または取得します。
window.location.href
2。URLに関連付けられたポート番号を設定または取得します。
window.location.port
3. URLのプロトコル部分を設定または取得する
window.location.protocol
4.疑問符に従うHREF属性の一部を設定または取得する
window.location.search
5。変数の値を取得します(等記号の後に部品を傍受)
コードコピーは次のとおりです。
var url = window.location.search;
// alert(url.length);
// alert(url.lastindexof( '='));
var loc = url.substring(url.lastindexof( '=')+1、url.length);
6. URLのプロトコル部分を設定または取得します。
window.location.protocol
7.ポンドサイン「#」の後、HREF属性のセグメントを設定または取得します:
window.location.hash
8.場所またはURLのホスト名とポート番号を設定または取得します。
window.location.host