问题描述
资源解释为文档,但使用 MIME 类型 text/css 传输
这是在 Google Chrome Inspector 中显示的错误.
This is the error that's showing up in Google Chrome Inspector.
文件是:http://www.doanddare.org/css/style.css
它正在由 php 处理器呈现.
It is being rendered by a php processor.
我该如何解决这个错误?
How can I fix this error?
返回的标题是:
Accept:application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
Cache-Control:max-age=0
User-Agent:Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.3 (KHTML, like Gecko) Chrome/6.0.472.63 Safari/534.3
响应标头
HTTP/1.1 200 OK
Date: Sun, 10 Oct 2010 07:35:04 GMT
Server: Apache
content-style-type: text/css
Expires: Thu, 10 Oct 2030 03:50:23 GMT
Cache-Control: max-age=631138519, public
Content-Encoding: gzip
Vary: Accept-Encoding
Transfer-Encoding: chunked
Content-Type: text/css
Connection: Keep-Alive
这可能与作为文档发送的请求标头和作为 css 文件返回的响应标头有关吗?
Could it be something to do with the request headers being sent as a document and the response headers returned as a css file?
如果是这样,我应该如何控制请求头?
If so, how should I control the request headers?
感谢您的帮助.
推荐答案
我只在 Chrome 上查看特定资源时出现错误.当我尝试打开 Javascript 文件 (.js) 时也会发生这种情况.
I only get error that when I view the specific resource on Chrome. This also happens when I try to open a Javascript file (.js).
我的结论是,当您在 Chrome 中打开组件文件(.css、.js)时,它会尝试将其解释为文档(在屏幕上显示输出),而不是将其解释为其原生 MIME 类型.
My conclusion is that when you open a component file (.css, .js) in Chrome, it will try to interpret as document (showing output on the screen), instead of interpreting it as its native MIME type.
说一个 Javascript 文件.如果你在 Chrome 中输入它,它应该被解释为文档(在屏幕上显示输出),而不是 Chrome 执行脚本(这是它的原生 MIME 类型所做的).
Say a Javascript file. If you enter it in Chrome, it should be interpreted as document (showing output on the screen), instead of Chrome executing the script (that's what its native MIME type does).
该消息仅适用于 Google Chrome,可以忽略不计,因为它仅在您打开组件文件时出现.
That message is Google Chrome only and is negligible, as it only appear when you open a component file.
这篇关于资源解释为文档,但使用 MIME 类型 text/css 传输的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!