更新时间:2023-11-26 11:20:34
新访问者当然不会有任何缓存图像,同时他们也希望您的网站加载速度快.如果您正在测试您的网站对他们的表现如何,那么只需清除缓存?
New visitors will of course not have any cached images, while they also want your site to load fast. If you're testing how well your site performs for them, then simply clear your cache?
如果只是为了调试:
If-Modified-Since
标头.)If-Modified-Since
标头, 见下文).这仍然会向您显示未修改".某些精简版 Firebug 也可用于 Internet Explorer.If-Modified-Since
header.)If-Modified-Since
header, see below). This will still show you "Not Modified" though. Some lite version of Firebug is also available for Internet Explorer.请注意,点击 F5/Refresh 将使大多数浏览器总是询问服务器浏览器已经缓存的内容是否发生了变化,即使它知道缓存应该仍然有效.然后请求将包含一个 If-Modified-Since
标头.如果服务器说它没有被修改,则使用缓存.喜欢:
Note that hitting F5/Refresh will make most browsers always ask the server if something has changed for the content which the browser already cached, even if it knows that the cache should still be valid. The request will then include a If-Modified-Since
header. If the server says it's not modified, then the cache is used. Like:
GET /ga.js HTTP/1.1
Host: www.google-analytics.com
...
If-Modified-Since: Mon, 22 Jun 2009 20:00:33 GMT
Cache-Control: max-age=0
HTTP/1.x 304 Not Modified
Last-Modified: Mon, 22 Jun 2009 20:00:33 GMT
Date: Sun, 26 Jul 2009 12:08:27 GMT
Cache-Control: max-age=604800, public
Server: Golfe
以上内容与仅浏览网站不同.单击链接或稍后返回页面时(键入地址、书签、搜索结果等),如果缓存仍然有效,浏览器将简单地使用缓存,而不会询问是否有任何更改.
The above is different from just navigating a site. When clicking links, or when coming back to a page at some later time (typing the address, bookmarks, search result, ...) a browser will simply silently use the cache if it is still valid, without asking if anything has changed.
(还要注意,代理服务器可能会做一些缓存.在上面的响应中,Cache-Control
中的 public
表示代理确实可以缓存特定的回应.)
(Also note that a proxy server may do some caching. In the above response, the public
in the Cache-Control
indicates that a proxy can indeed cache that specific response.)