Force IE8 or IE9 document mode to standards
Asked Answered
C

3

2

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

Candace answered 15/12, 2012 at 21:2 Comment(6)
This is the samw browser from the same company who had a famous "bug" called the Trailing Comma of DEATH!!! Maybe it's not you.Baseborn
But when I go to other sites in my same browser I see the mode set to standards so what an I doin wrong???Candace
Did you start with the HTML5 Boilerplate? Can you provide an entire page of markup that you know doesn't render properly?Baseborn
Your conditionals are all screwed up. Take a look at them; when I put that in a file with the rest HTML5 Response Boilerplate, it display. If I leave it in, blank page. It looks like you're trying to comment out conditionals. I don't think you can (?).Baseborn
This looks like a gigantic hack to me! What happens with a non-IE browser?! Then no <html>-tag is available...Cycle
possible duplicate of Force to use Internet Explorer IE9 standards document modeCrupper
A
8

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.

Arborization answered 12/3, 2013 at 16:21 Comment(0)
I
1

The 5th and 6th line of your code are in error and cause, as @JaredFarrish remarks in a comment, the page to display as blank on IE.

At the end of the 5th line, remove spaces from

<!     [endif]-->

At the end of the 6th line, change

<!--<!   [endif]-->

to

<![endif]-->

On your actual page, there is probably something in the code later that stops the skipping that the malformed construct causes on IE.

It’s still unclear what puts IE into Quirks Mode. More information is needed to address this issue. It could even depend on the domain in which the page is, so disclosing the URL may help. For generalities, see IE8 and IE9 Complications (in setting browser mode).

Insanitary answered 15/12, 2012 at 22:15 Comment(1)
I thought that said "For generations we've had IE8 and IE9 complications". I could get behind that.Baseborn
I
0

Ralph Bacon's answer just solve the issue for me. There is nothing wrong with the html5 boilerplate we are using. If you're intranet is using compatibility mode, then you should place this

<meta http-equiv="X-UA-Compatible" content="IE=edge">

after the

<!DOCTYPE HTML>

So overall, your header would look like this:

<!DOCTYPE html>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<!--[if lt IE 7]>      <html class="no-js lt-ie9 lt-ie8 lt-ie7" lang=""> <![endif]-->
<!--[if IE 7]>         <html class="no-js lt-ie9 lt-ie8" lang=""> <![endif]-->
<!--[if IE 8]>         <html class="no-js lt-ie9" lang=""> <![endif]-->
<!--[if gt IE 8]><!-->
<html class="no-js" lang="en">
<!--<![endif]-->
Inexperienced answered 14/7, 2015 at 7:8 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.