Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IE9 constantly using IE7 standards document mode no matter what I try

Tags:

This is driving me insane.

No matter what I try, Internet Explorer is switching to IE7 Standards Document Mode. I have tried stripping my code back to nothing to try and get it to behave, using HTML5 boilet plate AND HTML5 reset (whose own site goes into Quirks Mode).

I have also added the meta tag that is supposed to force IE to it's latest version no matter what, but all that has done is made my mark-up invalid according to W3C.

This is what I have; what am I missing?

<!doctype html>  <!--[if IE 7 ]> <html class="ie7> <![endif]--> <!--[if IE 8 ]> <html class="ie8> <![endif]--> <!--[if gt IE 8]><!--><html><!--<![endif]-->  <head>     <meta charset="utf-8">     <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">     <title></title>     <link rel="stylesheet" href="css/style.css"> </head> <body>     <p>Test text</p>         </body> </html> 

EDIT

I have a solution found via a suggestion below. The suggestion didn't work, but it did lead me to an answer. This might not be 100% suitable for everyone since it imposes a class on the body tag rather than html, but it works for me and seems to work for IE.

<!doctype html> <html> <head>     <meta charset="utf-8">     <title></title>     <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">     <link rel="stylesheet" href="css/style.css"> </head> <!--[if IE 7 ]> <body class="ie7> <![endif]--> <!--[if IE 8 ]> <body class="ie8> <![endif]--> <!--[if gt IE 8]><!--><body><!--<![endif]--> <p>Test text</p>         </body> </html> 
like image 519
Alan Shortis Avatar asked Oct 11 '12 10:10

Alan Shortis


People also ask

How do I change document mode to IE9 standards?

Change the Document Mode to Internet Explorer 9 Standards and try to view the content again. To change the Document Mode, press F12, click Document Mode: , and then select Internet Explorer 9 Standards."

How do I change the document mode in Internet Explorer?

In your Internet Explorer web browser, press F12 to open the Developer Tools window. Click Browser Mode and select the version of your web browser. Click Document Mode, and select the Internet Explorer standards for your Internet Explorer release.


1 Answers

from this thread

The X-UA-Compatible meta tag must appear straight after the title in the element. No other meta tags, css links and js scripts calls can be placed before it.

like image 172
Anoop Avatar answered Oct 07 '22 23:10

Anoop