Js - 获取url地址栏

来源:互联网 发布:雅思单词书推荐 知乎 编辑:程序博客网 时间:2024/05/17 23:28
url:http://www.x2y2.com:80/fisker/post/0703/window.location.html?ver=1.0&id=6#imhere1.window.location.href:返回整个url串2.window.location.protocol:返回协议部分,本例中为 http:3.window.location.host : 返回主机本分,本例中为www.x2y2.com4.window.location.port: 返回端口部分,在本例中为 ""(只要是采用的80端口。不管是默认的还是url后面带有80的字样)5.window.location.pathname:返回路径部分,在本例中为/fisker/post/0703/window.location.html6.window.location.search:返回查询参数部分,在本例中为?ver=1.0&id=67.window.location.hash:返回锚点部分,在本例中为#imhere
0 0