2014-11-01 71 views
-1

在IE浏览器中始终加载浏览器历史记录中的旧数据。为了获取最新数据,我需要始终清除浏览器历史记录。在IE浏览器中始终加载浏览器中的旧数据

如何总是加载新的数据? 有没有办法使用javascript清除浏览记录?

这似乎是因为

我试图像

<meta http-equiv='cache-control' content='no-cache'> 
<meta http-equiv='expires' content='-1'> 
<meta http-equiv='pragma' content='no-cache'> 
response.setHeader("Cache-Control", "no-cache, no-store, must-revalidate"); // HTTP 1.1. 
     response.setHeader("Pragma", "no-cache"); // HTTP 1.0. 
     response.setDateHeader("Expires", 0); // Proxies. 
var numberOfEntries = window.history.length; 
    window.history.go(-numberOfEntries); 

    var cookies = document.cookie.split(";"); 

    for (var i = 0; i < cookies.length; i++) { 
     var cookie = cookies[i]; 
     var eqPos = cookie.indexOf("="); 
     var name = eqPos > -1 ? cookie.substr(0, eqPos) : cookie; 
     document.cookie = name + "=;expires=Thu, 01 Jan 1970 00:00:00 GMT"; 
    } 

    window.history.replaceState(); 

     window.location.replace(document.url); 

没有几种方法Internet临时文件和网页文件似乎是工作

+0

代码你是如何做的? (特别是缓存标题) – 2014-11-01 09:34:06

回答

0

您是否尝试过每次以某种方式加载页面时都要更改页面,以查看 浏览器是否停止高速缓存旧页面。

您可以尝试在页面中放置一个隐藏的输入元素,然后更新页面加载的每个 的值,看看是否足以强制浏览器显示最新版本的页面。

这里是链接到的jsfiddle:http://jsfiddle.net/larryjoelane/nu1jpvjh/1/

HTML的一部分:

<input id="version" type = "hidden" value = "1"> 

jQuery的一部分:

 //the highest number you want to retrieve randomly 
     var upperLimit = 1000; 

    //get random number between 1 and 1000 
    //change upperlimit above to increase or 
    //decrease range 
    var randomNum = Math.floor((Math.random() * upperLimit) + 1);  


    //update the #version input box value 
    $("#version").val(randomNum); 
相关问题