How to prevent a jQuery Ajax request from caching in Internet Explorer?

如何防止在Internet Explorer中缓存jQuery Ajax请求?


You can disable caching globally using $.ajaxSetup() , for example:

$.ajaxSetup({ cache: false });

This appends a timestamp to the querystring when making the request. To turn cache off for a particular $.ajax() call, set cache: false on it locally, like this:

$.ajax({
  cache: false,
  //other options...
});

如果您设置了唯一的参数,则缓存不起作用,例如:

$.ajax({
    url : "my_url",
    data : {
        'uniq_param' : (new Date()).getTime(),
        //other data
    }});

Cache-Control: no-cache, no-store

这两个标题值可以组合在IE和Firefox上获得所需的效果

链接地址: http://www.djcxy.com/p/41990.html

上一篇: 如何从Internet Explorer 11降级到Internet Explorer 10?

下一篇: 如何防止在Internet Explorer中缓存jQuery Ajax请求?