1,将整个URL
设置为字符串:
window.location.href
2,设置或获取与URL相
关联的端口号:
window.location.port
三.设置或获取URL的协议部分
window.location.protocol
4、设置或获取部分的问号后面的href
属性 window.location.search
5。获取变量的值(截取相等后的部分)
复制代码代码如下所示:
var url = window.location.search;
警报(URL长度);
/ /警报(url.lastindexof(t));
无功禄= url.substring(url.lastindexof,+ 1,url.length(t));
6。设置或获取URL的协议部分:
window.location.protocol
7、集或元素的href属性#威尔斯号进入后段:
window.location.hash
8、设置或获取主机名和端口号的
位置或URL:
window.location.host