Resource interpreted as document but transferred with MIME type text/css
This is the error that’s showing up in Google Chrome Inspector.
The file is: http://www.doanddare.org/css/style.css
It is being rendered by a php processor.
How can I fix this error?
The headers being returned are:
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
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?
Thanks for any help.
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.
That message is Google Chrome only and is negligible, as it only appear when you open a component file.
I get the same error and I think I know why.
If you look at your request headers you see they include:
They especially do NOT include “text/css”. So Chrome is telling the server it will NOT accept a response of type “text/css” and when it gets such anyway it reports that happening on its console.
When I ordinarily include a CSS-stylesheet into an html-page the error-message does not show up because in those cases Chrome request-header says:
But if I try to set
iframe.src = someCssFile.css
I get the message. So it gives me the clue that I’m trying to load CSS to somewhere where it is not expected. It does load it, but console gives me the message.
And really it is not an error, it is a Warning, that’s what Chrome calls it. A Warning. But I agree it’s good to know what’s causing it.
I don’t think there’s any way to explicitly control the request-headers Chrome sends to the server. Browsers just interpret HTML and based on that come up with the headers they send.