Unexpected Caching of AJAX results in IE8

前端 未结 10 2162
走了就别回头了
走了就别回头了 2020-11-28 01:59

I\'m having a serious issue with Internet Explorer caching results from a JQuery Ajax request.

I have header on my web page that gets updated every time a user navig

10条回答
  •  粉色の甜心
    2020-11-28 02:30

    The answers here are very helpful for those who use jQuery or for some reason directly use the xmlHttpRequest object...

    If you're using the auto-generated Microsoft service proxy its not as simple to solve.

    The trick is to use Sys.Net.WebRequestManager.add_invokingRequest method in the event handler change the request url:

    networkRequestEventArgs._webRequest._url = networkRequestEventArgs._webRequest._url + '&nocache=' + new Date().getMilliseconds(); 
    

    I've blogged about this: http://yoavniran.wordpress.com/2010/04/27/ie-caching-ajax-results-how-to-fix/

提交回复
热议问题