【问题标题】:Content-Type is correct by still getting "Resource interpreted as Image but transferred with MIME type text/css."?Content-Type 是否正确,仍然得到“资源解释为图像但使用 MIME 类型文本/css 传输。”?
【发布时间】:2011-09-15 05:31:12
【问题描述】:

我的安装中的一个 css 文件收到以下警告:

Resource interpreted as Image but transferred with MIME type text/css.

如何解决这个问题? 我在 Rails 2.8.11 上使用 ruby​​ 运行 apache2。

服务器肯定发送了正确的内容类型:

Accept-Ranges:bytes
Connection:Keep-Alive
Content-Encoding:gzip
Content-Length:803
Content-Type:text/css
Date:Wed, 15 Jun 2011 04:20:45 GMT
ETag:"66941-921-49f967c2bd200"
Keep-Alive:timeout=15, max=96
Last-Modified:Tue, 29 Mar 2011 03:16:24 GMT
Server:Apache/2.2.12 (Ubuntu)
Vary:Accept-Encoding

但是,浏览器仍然声称“资源被解释为图像”。

【问题讨论】:

  • 你是如何嵌入 CSS 的?
  • 这个问题/答案可以是:stackoverflow.com/questions/658238/… 那里有几个选项。我最喜欢的是 导致类似的事情...我怀疑您的问题出在 HTML 上,因此您可能希望将其发布到生成该警告消息的页面
  • 那么,您检查文件是否真的是图像?

标签: css apache2


【解决方案1】:

我遇到了同样的问题,并通过修复我的一个 CSS 文件解决了这个问题。 我改了代码:

body { background:url(''); }

为:

body { background-image:none; }

解释: 由于url('') 指向自己,并且它是一个.css 文件,因此浏览器找不到它要填充url 的图像。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2011-04-23
    • 2013-08-25
    • 2013-07-02
    • 2011-12-24
    • 2014-05-20
    • 2012-12-20
    • 1970-01-01
    • 2010-11-26
    相关资源
    最近更新 更多