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