簡體   English   中英

History.Back與刷新

[英]History.Back with refresh

我想要History.back(); 功能完全刷新上一頁。

知道如何做到這一點(並使其在IE,FF和Chrome中工作)。

您可以將(通過window.location)重定向到document.referrer

window.location.href = document.referrer;

Internet Explorer修復了將referrer傳遞到特定位置的問題:

if(IE){ //IE, bool var, has to be defined
    var newlocation = document.createElement('a');
    newlocation.href = URLtoCall;
    document.body.appendChild(newlocation);
    newlocation.click();
}

您還可以使用location replace()方法:

window.location.replace(document.referrer)

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM