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

完整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 (信息片断(锚点))
posted @ 2015-10-28 16:13  yu0312chao  阅读(624)  评论(0编辑  收藏  举报