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

5年以前  |  阅读数:364 次  |  编程语言:JavaScript 

完整URL组成部分:scheme://host:port/path?query#fragment

地址说明

Javascript代码

window.location.href //整个URI字符串
window.location.protocol //(scheme:通信协议)
window.location.host // (主机名(域名或IP地址))
window.location.port  // (端口号)
window.location.pathname // (路径)
window.location.search  // (参数)
window.location.hash (信息片断(锚点))

Copyright© 2013-2020

All Rights Reserved 京ICP备2023019179号-8