TLDR即使使用URL中包含的Math.random(),IE仍然缓存我的请求。即使使用mathrandom,IE8仍然缓存我的请求
所以我加入数学随机到我的网址的结尾:
var MYKMLURL = 'http://' + host + 'data/pattern?key='+ Math.random();
我还添加了数学随机到我的功能PARAM:
window.setTimeout(RefreshPatternData, 1000, MYKMLLAYER);
function RefreshPatternData(layer) {
layer.loaded = false;
layer.setVisibility(true);
layer.refresh({ force: true, params: { 'key': Math.random()} });
setTimeout(RefreshPatternData, 30000, MYKMLLAYER);
}
因此请求显示为http://host/data/pattern?key=35678652545等
每次请求都会发生变化。
它适用于Firefox & Chrome & Safari等,但IE8仍然缓存数据,而不是更新我的图层。
任何想法为什么这可能会发生?
,所以我说:
<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate">
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Expires" content="0">
仍在缓存中的数据。还有什么想法?
哦,我以前见过这个。对于缓存来说,IE是braindead,即使服务器另有说明,也会将所有内容缓存在视图中。这需要一些神奇的HTTP头来说服它否则... – Thanatos 2010-06-09 03:38:52
我有同样的问题。元标记在IE8中不起作用。我只能使用F12开发人员工具中的选项禁用客户端上的缓存。 – 2013-04-17 11:18:52