FireFox 不缓存 CSS 背景图像

发布于 2024-08-22 15:15:35 字数 620 浏览 3 评论 0原文

我使用 YUI3 动态地将 标签添加到页面,并且工作正常。

出于测试目的,我有两个几乎相同的 css 文件,其中包含完全相同的背景图像,但是当我加载第二个 css 文件时,Firebug 显示正在对第一个 css 文件中的相同图像发出更多 http 请求。

JS

Y.one('head').appendChild(Y.Node.create('<link rel="stylesheet" id="' + cObject[target] + 'css' + '" type="text/css" href="css/' + c[target] + '.css" />'));

A css bg 示例

background-image: url(../../img/layout/apic.png);

我显然不希望这种情况发生,但不知道从哪里开始寻找。这可能在其他浏览器中执行相同的操作,但我不知道其他浏览器有哪些插件可用(如果有)。

编辑:标头似乎没问题,但该错误可能是罪魁祸首...我可以在 IE/Chrome/Safari 中使用什么来测试 http 请求,看看它是否只是 FF?

I am dynamically adding <link> tags to the page using YUI3 and this works properly.

For testing purposes I have two nearly identical css files which include the exact same background images however when I load the second css file, Firebug shows that more http requests are being made for the same images in the first css file.

The JS

Y.one('head').appendChild(Y.Node.create('<link rel="stylesheet" id="' + cObject[target] + 'css' + '" type="text/css" href="css/' + c[target] + '.css" />'));

A css bg example

background-image: url(../../img/layout/apic.png);

I obviously would like this to not happen but don't know where to start looking. This may do the same in other browsers but I do not know what plugins are available (if any) for the other browsers.

EDIT: The headers appear to be fine but that bug might be the culprit...What can I use in IE/Chrome/Safari to test for the http requests to see if it is ONLY FF?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

饮惑 2024-08-29 15:15:36

可能与此处描述的问题相同:浏览器缓存在 firefox 中被绕过?

Possibly it's the same problem as described here: browser cache bypassed in firefox?

北渚 2024-08-29 15:15:36

检查图像响应中发送的 HTTP 标头。

特别注意影响客户端缓存的标头,例如 Expires、Etag、Last-modified 等...

检查它们是否正确设置/发送,并且您知道如何使用它们。

Check the HTTP headers being sent in the image response.

Look particularly for headers that impact client-side caching, such as Expires, Etag, Last-modified, etc...

Check that they are being set/sent correctly, and that you know how to use them.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文