Html – Force IE8 or IE9 document mode to standards

cross-browserhtmlie8-browser-modeinternet-explorer-9

Ok so sorry for being blunt here but I have been developing on IE 8 and IE9 for the past 2 years and can't seem to get this right. I work at abhor company and develop for their website. For some reason IE8 or IE9 defaults to a lower document mode like ie7 or ie8. I have tried everything…

1) put HTML 5 doctype and nothing else. According to Microsoft this should be enough
2) put html5 doctype and put x-ua-compatible meta tag first in the page under title and set to either edge or IE8 or IE9 respectively.

My page looks like this

<!DOCTYPE html>
<!--[if lt IE 7]>      <html class="no-js lt-ie9 lt-ie8 lt-ie7">
<![endif]-->
<!--[if IE 7]>         <html class="no-js lt-ie9 lt-  ie8"> <![endif]-->
<!--[if IE 8]>         <html class="no-js lt-ie9"> <!     [endif]-->
<!--[if gt IE 8]> <html class="no-js"> <!   [endif]-->

<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible"    content="IE=edge,chrome=1">

It's really getting frustrating because everything I read says it should work. Microsoft claims this will work or even just settings HTML 5 doctype will work. I've heard to set a http header to fix but honestly, is Microsoft serious? I find it hard to believe that developers need tot change their apache settings to add a http header to Make page render I'm standards mode

Can someone please help me here? What am I missing??? I'm really beginning to hate Microsoft Even more!!!!!

UPDATE::

I recently discovered that my company has the "show intranet sites in compatibility view" checked off and it looks l like if i uncheck it then it will work fine. However, that is not the solution! Everywhere i read i see that if you see the X-UA-compatible meta tag or http header it should take precedence. Well this is a complete lie. Does anyone else have an answer?? I understand that external users will be fine however my business is testing this and they are asking questions because they are internal and its hard to convince them and to tell them to uncheck the box. It doesnt give them a great feeling. Also, i cant have the desktop engineering team remove that because it was put in place because older applications internally are not written to support IE8,9 so they need this.

Any help is appreciated. thanks!

Thanks

Best Answer

Our intranet is also locked down with Compatibility View being used for all Intranet sites and uses IE 8 as they are all Windows XP.

I found that once IE 8 started processing the standard boiler plate conditional comments (to determine which class to attach to the <html> tag) then it was game over: IE decided at that point it was running in Compatibilty Mode (IE 7) and nothing I could do would recover the situation.

I found that by placing the <meta> tag immediately after the <!DOCTYPE> tag it all worked exactly as expected:

<!DOCTYPE HTML>
<meta http-equiv="x-ua-compatible" content="IE=Edge">

To my eyes this doesn't seem very "standard" but it works. I'd love any alternative methods of doing this where the <meta> tag could be placed into the <head> as I tried for hours to do.

Related Topic