如果没有Expires Header,不同的浏览器如何处理静态内容的缓存? [英] How do different browsers handle caching for static content without an Expires Header?

查看:243
本文介绍了如果没有Expires Header,不同的浏览器如何处理静态内容的缓存?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在网站上运行 YSlow插件后,我看到其中一个建议是为脚本,样式表和图像添加远期未来的过期标题。

After running the YSlow plugin on a site, I saw that one of the recommendations was to add far future expires headers to the scripts, stylesheets, and images.

我问了一个不同的问题关于如何在IIS中设置它,但我实际上只是对每个浏览器的行为方式感到好奇。

I asked a different question about how to set this up in IIS, but I am actually just curious about how each browser behaves.

我已经读过IE会为每个浏览会话缓存项目,所以一旦你关闭浏览器后重新打开网站,就需要重新加载所有内容。我相信Firefox会继续自行设置到期日期。我还听说过,当通过HTTPS连接时,IE根本不会缓存。不过,我不确定这些是否准确无误,并且想知道是否有人可以澄清我可能有的任何误解。谢谢!

I have read that IE will cache items per browsing session, so once you reopen the site after closing the browser, it will need to reload all of the content. I believe that Firefox will go ahead and set a expiration date on its own. I have also heard that IE does not cache at all when connecting over HTTPS. I am not sure if these are at all accurate, though, and was wondering if someone could clear up any misconceptions I may have. Thanks!

推荐答案

你对Firefox设置自己的到期日期是正确的。请参阅此博客文章中的第二项:

You are right about Firefox setting its own expiration date. See the second item in this blog post:

http://blog.httpwatch.com/2008/10/15/two-important-differences-between-firefox-and-ie-caching /

与Firefox一样,IE可以缓存基于HTTPS的内容。但是,您需要在Firefox中的浏览器会话中设置Cache-Control:public以进行持久缓存。请参阅此博客文章中的提示#3:

IE, like Firefox, can cache HTTPS based content. However, you need to set Cache-Control: public for persistent caching across browser sessions in Firefox. See Tip #3 in this blog post:

http://blog.httpwatch.com/2009/01/15/https-performance-tuning/

这篇关于如果没有Expires Header,不同的浏览器如何处理静态内容的缓存?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆