是“过期”吗?在http header有用吗?
浏览器中静态文件(如图像/js/css)的缓存是否有默认行为? 即使我没有在服务器上设置过期时间,我发现我的浏览器(Firefox,IE8)也可以从本地缓存中读取静态文件,那么“过期时间”有用吗?
Is there a default behavior for cache of static files like images/js/css in browsers?
Even if I did not set the expires on my server, I found that my browser(Firefox, IE8) could also read the static files from local cache, so is the "Expires" useful?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
是的,它绝对有用。如果您不设置标头,客户端必须猜测内容何时过期。您可能不喜欢它的猜测方式,并且某些浏览器比其他浏览器或多或少具有攻击性。请阅读 http ://blogs.msdn.com/b/ie/archive/2010/07/14/caching-improvements-in-internet-explorer-9.aspx进行充分的讨论。
Yes, it's absolutely useful. If you don't set the header, the client must guess when the content expires. You may not like how it guesses, and some browsers are more or less aggressive than others. Please read http://blogs.msdn.com/b/ie/archive/2010/07/14/caching-improvements-in-internet-explorer-9.aspx for a full discussion.