您的位置:首页 > Web前端 > JavaScript

js对于地址栏中的URI的解析

2015-10-28 16:13 344 查看
完整URL组成部分:scheme://host:port/path?query#fragment

scheme:通信协议
host:主机名(域名或IP地址)
port:端口号
path:路径
query:参数(多个参数之间用'&'分割)
fragment:信息片断(锚点)

window.location.href 整个URI字符串
window.location.protocol (scheme:通信协议)
window.location.host(主机名(域名或IP地址))
window.location.port (端口号)
window.location.pathname(路径)
window.location.search (参数)
window.location.hash (信息片断(锚点))
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: