如何防止在Internet Explorer中缓存jQuery Ajax请求?
如何防止在Internet Explorer中缓存jQuery Ajax请求?
您可以使用$.ajaxSetup()
全局禁用缓存,例如:
$.ajaxSetup({ cache: false });
这会在发出请求时在查询字符串附加一个时间戳。 要关闭特定$.ajax()
调用的cache: false
,请在本地设置cache: false
,如下所示:
$.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/41989.html上一篇: How to prevent a jQuery Ajax request from caching in Internet Explorer?
下一篇: Does Internet Explorer support pushState and replaceState?