JS获取当前页面页面URL信息
来源:互联网 发布:中国运输服务贸易数据 编辑:程序博客网 时间:2024/05/17 07:38
完整的URL由这几个部分构成:
scheme://host:port/path?query#fragment
scheme:通信协议
常用的http,ftp,maito等
设置或获取对象指定的文件名或路径。
url = http://www.baidu.com/baidu/postedit/46887983?wd=hei+jude&tn=monline_4_dg
window.location.pathname;
---> "/baidu/postedit/46887983"
设置或获取整个 URL 为字符串。
url = http://www.baidu.com/baidu?wd=hei+jude&tn=monline_4_dg
window.location.href;
---> "http://www.baidu.com/baidu?wd=hei+jude&tn=monline_4_dg"
设置或获取与 URL 关联的端口号码。
url =http://192.168.14.97:2000/analytics/profiles/
window.location.port;
---> "2000"
设置或获取 URL 的协议部分。
url = http://www.baidu.com/baidu?wd=hei+jude&tn=monline_4_dg
window.location.protocol;
---> "http:"
设置或获取 href 属性中在井号“#”后面的分段。
url = http://192.168.2.11/forum.php?mod=viewthread&tid=65&page=1&extra=#pid207
window.location.hash;
---> "#pid207"
设置或获取 location 或 URL 的 hostname 和 port 号码。
url = http://192.168.14.97:2000/analytics/profiles/
window.location.host;
---> "192.168.14.97:2000"
设置或获取 location 或 URL 的 hostname。
url = http://192.168.14.97:2000/analytics/profiles/
window.location.hostname;
---> "192.168.14.97"
设置或获取 href 属性中跟在问号后面的部分。
url = http://www.baidu.com/baidu?wd=hei+jude&tn=monline_4_dg
window.location.search; --->
"?wd=hei+jude&tn=monline_4_dg"
获取变量的值(截取等号后面的部分)
var url = window.location.search;
var loc = url.substring(url.lastIndexOf('=')+1, url.length);
- JS获取当前页面页面URL信息
- JS获取当前页面的URL信息
- js获取当前页面的url信息
- js获取当前页面url信息
- js获取当前页面的URL信息
- js获取当前页面的URL信息
- js获取当前页面的URL信息
- js获取当前页面url信息
- js获取当前页面url网址信息
- JS: 获取当前页面URL
- JS: 获取当前页面URL
- JS获取当前页面的URL等信息
- js获取当前页面的url网址信息
- js获取当前页面的url网址信息[转载收藏]
- 使用JS获取当前页面的URL(网址信息)
- js如何准确获取当前页面url网址信息
- js如何准确获取当前页面url网址信息
- js如何准确获取当前页面url网址信息
- 整理Linux查看系统日志的一些常用命令
- 这是第一篇
- 无限式查找(C百例)
- 函数模板的特化
- 浅谈序列化与反序列化的理解
- JS获取当前页面页面URL信息
- 20个代码生成框架
- OC--字符串
- iOS中的键盘关闭操作
- java处理高并发高负载类网站的优化方法
- Android HOOK工具Cydia Substrate使用详解
- 10个redis和10个t-sql
- x86 汇编程序基础
- Java4Android-this的使用方法