URL為統(tǒng)一資源定位符,對于如下url
http://www.php230.com:80/fisker/post/0703/window.location.html?ver=1.0&id=6#imhere
window.location.href
返回整個URl字符串(在瀏覽器中就是完整的地址欄)window.location.protocol
返回URL 的協(xié)議部分易猫,httpwindow.location.host
返回URL 的主機部分,www.php230.comwindow.location.port
返回URL 的端口部分window.location.pathname
返回URL 的路徑部分(就是文件地址)轰绵,:/fisker/post/0703/window.location.htmlwindow.location.search
查詢(參數)部分匣屡,?ver=1.0&id=6window.location.hash
錨點,#imhere
Tips
參數只能放到hash前政溃,#后的參數用location.search是查詢不到的