Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IE9 standard view no load CSS

I have this problem and maybe I'm not the only..

If I test my website on FF, Chrome, Safari, IE7, IE8 is perfect.

On IE9 (standard view) It doesn't load CSS files. If I switch on Compatibilty view it works fine...

How can I show the CSS on the standard view as well?

Thanks

like image 549
Andrea Turri Avatar asked Nov 22 '11 12:11

Andrea Turri


2 Answers

IE9 is known to reject stylesheets which are not sent using "text/css" MIME type. This is a new security enhancement, but it's catching a few people off guard. Is your CSS file dynamically generated? Make sure its getting passed as 'text/css'.

More info: http://blogs.msdn.com/b/ieinternals/archive/2011/03/27/http-406-not-acceptable-php-ie9-standards-mode-accepts-only-text_2f00_css-for-stylesheets.aspx


Another try:: It's not just 'text/css' in the doc that needs to be correct, you need to make sure your local IIS is sending it with the proper headers. "If a style sheet is ignored due to an incorrect MIME-type, your site may fail to render as expected. Text, images, or other features may lack the desired styling. If a style sheet is ignored because it does not bear the correct MIME-type, a notification will be logged in the IE9 F12 Developer Tools console."

http://msdn.microsoft.com/en-us/library/gg622939%28VS.85%29.aspx

IE9 Not applying linked style sheets

like image 166
Graham Avatar answered Nov 17 '22 06:11

Graham


I'm assuming your local web server is running IIS. If so, just map the .css file extension to the "text/css" MIME type. Like this...

In IIS v7.x:

  1. Click "MIME Types". You should see a list of file extensions and the associated MIME type.
  2. There should be an entry for the ".css" extension with MIME type = "text/css".
  3. If not, add it by right-clicking anywhere on the list -> Add... -> type in the ".css" extension and "text/css" MIME type.

In IIS v6:

  1. Right-click the server node -> Properties -> "MIME Types...". You should see a list of file extensions and associated MIME the type.
  2. There should be an entry for the ".css" extension with MIME type = "text/css".
  3. If not, add it by clicking "New..." -> type in the ".css" extension and the "text/css" MIME type.
like image 32
K Lee Avatar answered Nov 17 '22 07:11

K Lee