JavaScript获取http,http://请求协议头,域名,端口,url


window.location.protocol 获取http,http://请求协议头
window.location.host 获取域名并带端口 xxx.com 如果有端口就是 xxx.com:8080
window.location.hostname; 获取域名: xxx.com
window.location.href; 获取整个url地址:http://xxx.com/xxx.html
window.location.pathname; 获取域名后面请求路径url: /xxx/xxx.html
window.location.port 获取端口比如 8080


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM