浏览器缓存绕过Firefox? [英] browser cache bypassed in firefox?
问题描述
考虑下面的html页面,它可以载入许多大的png文件:
< html>
< head>
< script type =text / javascript>
function hide()
{document.getElementById(here)。innerHTML =hidden;
}
函数show()
{var loadMe =;
for(var i = 1; i <250; i ++)
{loadMe + =< img src ='http://domain.com/+ i +_a.png> ;<峰; br>中;
loadMe + =< img src ='http://domain.com/+ i +_b.png>< br>;
}
document.getElementById(here)。innerHTML = loadMe;
}
< / script>
< / head>
< body>
< a href =javascript:hide();>隐藏< / a>
< a href =javascript:show();> show< / a>
< div id =here>< / div>
< / body>
< / html>
在IE中,Safari&在Windows机器上的Opera,当显示和隐藏按钮被切换时,这个页面上的图像只加载一次(用FreeMeter监视)。
然而,在Firefox(新鲜安装),一些镜像从服务器多次加载(我们永远不会匹配网络请求中的初始高峰......从缓存中加载一些东西)。图片的回复标题为:
日期星期三,18三月2009 11:42:02 GMT
服务器Apache / 2.2.3(红帽)
最后修改星期一,27十月2008 19:19:47 GMT
Etag1abb7d7-292-45a41039f7ac0
接受-Ranges bytes
Content-Length 658
Cache-Control max-age = 7257600
过期2010年4月15日星期四20:00:00 GMT
连接关闭
内容-type image / png
纵览 about:cache ,大部分加载的图像似乎列在那里(虽然激励在隐藏/显示点击之间进行缓存,看起来缺少图像):
条目数量:462
最大存储容量:50000 KiB
存储在使用中:5593 KiB
...
Key:http://domain.com/23_a.png
数据大小:16139字节
提取计数:13
上次修改时间:2009-03-18 07:40:14
过期时间:2009-06-10 07:40:00
我希望从缓存中重新加载这些图像,所以我们可以轻松地进行网络调用?
更新
如果我在显示/隐藏第一个选项卡之后在新选项卡中打开此页面,则第二个选项卡不会发出网络请求。第一个标签继续发出网络请求。 解决方案
.org / show_bug.cgi?id = 290032rel =nofollow noreferrer>这里
Consider the following html page, which can load in many large png files:
<html>
<head>
<script type="text/javascript">
function hide( )
{ document.getElementById("here").innerHTML = "hidden";
}
function show( )
{ var loadMe = "";
for (var i=1; i<250; i++)
{ loadMe += "<img src='http://domain.com/" + i + "_a.png'><br>";
loadMe += "<img src='http://domain.com/" + i + "_b.png'><br>";
}
document.getElementById("here").innerHTML = loadMe;
}
</script>
</head>
<body>
<a href="javascript:hide();">hide</a>
<a href="javascript:show();">show</a>
<div id="here"></div>
</body>
</html>
In IE, Safari & Opera on a windows machine, the images on this page are only loaded once (monitored with FreeMeter) when the show and hide buttons are toggled.
However, in Firefox (freshly installed), some images are loaded from the server multiple times (we never match the initial peak in network requests... a few things are loaded from the cache).
The response headers of the images read:
Date Wed, 18 Mar 2009 11:42:02 GMT
Server Apache/2.2.3 (Red Hat)
Last-Modified Mon, 27 Oct 2008 19:19:47 GMT
Etag "1abb7d7-292-45a41039f7ac0"
Accept-Ranges bytes
Content-Length 658
Cache-Control max-age=7257600
Expires Thu, 15 Apr 2010 20:00:00 GMT
Connection close
Content-Type image/png
Looking into about:cache, most of the images loaded appear to be listed there (although inspecting the cache between hide/show clicks, there appears to be missing images):
Number of entries: 462
Maximum storage size: 50000 KiB
Storage in use: 5593 KiB
...
Key: http://domain.com/23_a.png
Data size: 16139 bytes
Fetch count: 13
Last modified: 2009-03-18 07:40:14
Expires: 2009-06-10 07:40:00
What's firefox expecting from me to reload these images from the cache so we can go easy on the network calls? Thank you!
Update
If I open this page in a new tab after showing / hiding in the first tab, the second tab makes no network requests. The first tab continues to make network requests.
The bug is described here
这篇关于浏览器缓存绕过Firefox?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!