window.location
window.location 对象所包含的属性
参考地址:http://blog.csdn.net/qq_27093465/article/details/50731087
测试:
console.info("获取当前URL完整的内容:" + window.location.href); console.info("截取URL?后的内容:" + window.location.search); console.info("截取URL#后的内容:" + window.location.hash); console.info("截取URL表示路径的内容:" + window.location.pathname); console.info("获取URL网络协议:" + window.location.protocol); console.info("获取URL域名:" + window.location.hostname); console.info("获取URL端口号:" + window.location.port); console.info("获取URL域名+端口号:" + window.location.host);
结果:
UpdateTime--2018年2月5日09:16:26
方法 描述
reload() 刷新页面
replace(url) 跳转到指定的URL
<input id="ReloadButton" type="button" class="controlShow2"
onmouseover="javascript:this.className='controlShowOver2'"
onmouseout="javascript:this.className='controlShow2'"
onclick="JavaScript:window.location.reload(true);" value=" 刷 新 " />
本文来自博客园,作者:Marydon,转载请注明原文链接:https://www.cnblogs.com/Marydon20170307/p/8391287.html