頁面重載
true 強制從服務器加載
false 優先從緩存加載
window.location.reload(true);
window.location.href、self.location.href、location.href是本頁面跳轉
parent.location.href 是上一層頁面跳轉
top.location.href 是最外層的頁面跳轉
window.history.forward() 前進 window.history.back() 后退 window.history.go(1) 前進 window.history.go(-1) 后退
window.location.href = "http://www.baidu.com";
window.location.assign("http://www.baidu.com");
window.location.replace("http://www.baidu.com");
window.location.assign(url) : 加載URL 指定的新的 HTML 文檔。就相當於一個鏈接,跳轉到指定的url,當前頁面會轉為新頁面內容,可以點擊后退返回上一個頁面。
window.location.replace(url) : 通過加載 URL 指定的文檔來替換當前文檔 ,這個方法是替換當前窗口頁面,前后兩個頁面共用一個
窗口,所以是沒有后退返回上一頁的