控制应该已经缓存的Web文件的缓存 [英] Controlling cache of web files that should be cached already
问题描述
我正在使用Fiddler2查看页面加载时间.有很多jpg,gif,png等.列出.我相信大多数返回码304表示浏览器不必再次下载该代码.看来,即使它没有再次下载,检查中还是有开销的.我有33个这样的物体,往返仅检查是否接近40K!?有没有一种方法可以阻止浏览器进行检查以节省40K和所需的时间?我正在使用asp.net,但这似乎是html的通用问题.作为后续操作,如何控制简单CSS文件的缓存时间.
I'm using Fiddler2 to see page load times. There are lots of jpg,gif,png,etc. listed. Most return code 304 which I believe means that the browser does not have to download that again. It seems that even though it does not download again, there is overhead in the checking. I have 33 such objects and round trip just to check is close to 40K ! ? Is there a method that keeps the browser from even checking in order to save the 40K and time needed? I am using asp.net, but this seems like a generic question for html. As a follow up how to control the cache time of simple CSS files.
谢谢,罗恩
推荐答案
与HTML无关.它与 HTTP 有关.阅读缓存控制标头,其中指示浏览器(和任何中间缓存)将内容缓存多长时间,以及何时/是否应检查较新的版本.
It has nothing to do with HTML; it has to do with HTTP. Read up on the Cache-Control headers, which instruct the browser (and any intermediary caches) how long to cache something, and when/whether it should check for a more recent version.
这篇关于控制应该已经缓存的Web文件的缓存的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!