IE7 不通过 SSL 缓存 CSS 图像
我正在使用 Internet Explorer 的 WebDevHelper 工具栏对 SSL 上的 HTTP 请求/往返进行故障排除 网站,并注意到 IE 会在每次触发时重新下载我的 CSS :hover 图像。这会导致大量的往返。
我怎样才能防止这种情况发生?
编辑:所有静态内容均通过cache-control: public提供,因此图像、JavaScript 等会缓存在 Firefox 和 Chrome 中。这个问题是 IE 特有的。
I'm using the WebDevHelper toolbar for Internet Explorer to troubleshoot HTTP requests/roundtrips on my SSL site and noticed that IE re-downloads my CSS :hover images every time they are triggered. This causes a huge amount of roundtrips.
How can I prevent this from happening?
Edit: All static content is served with cache-control: public, so images, javascript etc. are cached in Firefox and Chrome. This problem is IE specific.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
当然,通过 http 提供静态内容,但不要为 :hover 状态提供单独的图像。应使用正确的 css 图像精灵。通过 https 或 http,这都是很好的做法。有大量资源可用于创建精灵。据推测,SpriteMe [ http://spriteme.org/ ] 是尝试自动创建 css 图像精灵。
Serve static content via http, sure, but don't do separate images for :hover states. Proper css image sprites should be used. It's just good practice all around, via https or http. There are tons of resources available for creating sprites. Supposedly SpriteMe, [ http://spriteme.org/ ] is an attempt to automate css image sprite creation.
如果图像是从与主页不同的主机名传递的,那么您将遇到此处描述的工件:
http://blogs.msdn.com/ieinternals/archive/2010/04/21/Internet-Explorer-May-Bypass-Cache-for-Cross-Domain-HTTPS-Content.aspx
If the images are being delivered from a different hostname than your main page, then you're hitting the artifact described here:
http://blogs.msdn.com/ieinternals/archive/2010/04/21/Internet-Explorer-May-Bypass-Cache-for-Cross-Domain-HTTPS-Content.aspx
根据其他 Stackoverflow 帖子,存在多个问题。 FireFox 2.x也有这个问题。但FireFox 3.x 没有。
浏览器是否会通过 https 缓存内容
网络 资源管理器,您转到“工具”>“互联网选项>高级选项卡>安全部分>不要将加密的页面保存到磁盘。在 IE6、7 和 8 中默认情况下似乎未选中此选项。
Well there are multiple issues according to other Stackoverflow posts. FireFox 2.x also has this problem. But FireFox 3.x doesn't.
Will web browsers cache content over https
Also in Internet Explorer, you go to Tools > Internet Options > Advanced tab > Security section > Do not save encrypted pages to disk. It appears to be unchecked by default in IE6, 7 and 8.
出于安全原因,不会缓存通过 SSL 提供的内容。如果您想要缓存某些内容,请通过 HTTP 提供服务。
Content served via SSL will not be cached for security reasons. If you want something to be cached, serve it via HTTP.
您是否尝试过添加这些类型的静态文件的标头。
我知道这可以在 IE 中使用,允许通过框架集和其他内容存储 cookie。不确定它是否适用于 HTTPS 下的静态文件。
Have you tried adding to the header for those type of static files.
I know this works with in IE to allow storage of cookies through framesets and stuff. Not sure if it works with static files under HTTPS.
我知道这听起来很奇怪...
尝试输入不存在的 URL(404 错误)。此后,所有其余图像将被缓存。
I know it sounds weird...
try to put a url to something that isn't exists (404 error). after this, all the rest of the images will be cached.