5. window.location.href/replace/reload()--頁面跳轉+替換+刷新


1、window.location=url;

window.location 對象用於獲得當前頁面的地址 (URL),並把瀏覽器重定向到新的頁面。

 

一、最外層top跳轉頁面,適合用於iframe框架集

top.window.location.href("${pageContext.request.contextPath}/Login_goBack");

============================================================================================

二、window.location.href和window.location.replace的區別 

1.window.location.href=“url”:改變url地址; 

2.window.location.replace(“url”):將地址替換成新url,該方法通過指定URL替換當前緩存在歷史里(客戶端)的項目,
因此當使用replace方法之后,你不能通過“前進”和“后 退”來訪問已經被替換的URL,這個特點對於做一些過渡頁面非常有用!

三、強制頁面刷新 

1.window.location.reload():強制刷新頁面,從服務器重新請求!

 

 //1.window.document.location.href
 //2.window.document.location
 //3.window.location.href
 //4.window.location
 //5.document.location.href
 //6.document.location
 //7.location.href
 //8.window.navigate
 //9.location.replace

 

<script language="javascript">
    setTimeout('window.navigate("top.html");',2000);
    setTimeout('window.document.location.href="top.html";',2000);
    setTimeout('window.document.location="top.html";',2000);
    setTimeout('window.location.href="top.html";',2000);
    setTimeout('window.location="top.html";',2000);
    setTimeout('document.location.href="top.html";',2000);              
    setTimeout('document.location="top.html";',2000);
    setTimeout('location.href="top.html";',2000);
    setTimeout('location.replace("top.html")',2000);

</script>

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM