-
獲取上一個頁面的一個URL,這個URL一般做一個頁面的跳轉
window.location.href
<script>window.location.href="http://www.baidu.com"</script>
-
獲取一個頁面的主機名
window.location.hostname
-
獲取一個頁面的主機名和端口號相當於是hostname和port
window.location.host
-
獲取主機的端口號
window.location.port
-
獲取URL的路徑部分
window.location.pathname
-
獲取查詢部分的URL
window.location.searchURL
-
獲取html中的第一個#(描點)
window.location.hash
- location.search 鏈接問號后