如何用js得到当前页面的url信息方法
生活随笔
收集整理的這篇文章主要介紹了
如何用js得到当前页面的url信息方法
小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
設(shè)置或獲取對象指定的文件名或路徑。window.location.pathname
設(shè)置或獲取整個(gè) URL 為字符串。window.location.href;
?
設(shè)置或獲取與 URL 關(guān)聯(lián)的端口號碼。window.location.port
設(shè)置或獲取 URL 的協(xié)議部分。window.location.protocol
設(shè)置或獲取 href 屬性中在井號“#”后面的分段。window.location.hash
設(shè)置或獲取 location 或 URL 的 hostname 和 port 號碼。window.location.host
設(shè)置或獲取 href 屬性中跟在問號后面的部分。window.location.search
?
獲取變量的值(截取等號后面的部分) var url = window.location.search;
轉(zhuǎn)載于:https://www.cnblogs.com/helkl/p/4316073.html
總結(jié)
以上是生活随笔為你收集整理的如何用js得到当前页面的url信息方法的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 忘记redhat linux root密
- 下一篇: 微架构设计:微博计数器的设计