page opens in IE7 document mode instead of IE9
Asked Answered
G

4

12

I know many variations of this question have been asked here but so far no solutions I have tried work for me.

I would like my web app to open in IE9 document mode in IE. When I open the page now, it always opens in 'Internet Explorer7 Standards), while 'Internet Explorer9 standards' is listed as the page default. I have tried several variations of tagss, including

<meta http-equiv="X-UA-Compatible" value="IE=Edge">

and

<meta http-equiv="X-UA-Compatible" content="IE=7,IE=9">

(both right after the head tag)

I have also tried conditional statements, such as this example from S.O.:

<!--[if IE 7 ]> <body class="ie7> <![endif]-->
<!--[if IE 8 ]> <body class="ie8> <![endif]-->
<!--[if gt IE 8]><!--><body><!--<![endif]-->

Currently I am using: <!DOCTYPE html>

Of course I can manually switch the mode in F12, but I would like to site to open directly in IE9 Document mode (the Compatibility mode always defaults to IE9 Compatibility mode).

Currently I am working on an intranet development server; I have read that this may be a factor? But I would really prefer any solutions to be client-side, that I can add to the JS/HTML.....

Greater answered 3/4, 2013 at 18:25 Comment(5)
The first one should do, but you are missing angle brackets: <meta http-equiv="X-UA-Compatible" value="IE=Edge">. Also, this element should be in the <head>.Signatory
Intranet sites by default are rendered in compatibility mode and safest solution to this is usually done server-side. Take a look at: #2518756Estrin
I realize the <> are not there, and both are in the head tag as I stated aboveGreater
@Adrift..forgive my ignorance, but I am not sure which file you mean? I do not have a web.config file directly associated with my app (not using VS)...the app is run form Windows server 2008r2.Greater
spudley.com/blog/keeping-ie-in-standards-modeLaresa
P
25

Developer Tools Manually Overriding the Document Mode

If Internet Explorer 9 Standards is listed as the Page Default, this means you may have manually changed it to Internet Explorer 7 Standards via the tools. Just switch it back to Internet Explorer 9 Standards in the F12 Developer Tools themselves.

The tools will remember your explicit request to show the page in another Document Mode, and as such not revert to the page default. Consider the following from MSDN:

When you first load a webpage, F12 tools determines the default Document Mode and selects the appropriate mode. The text Page default in parentheses indicates the default mode of the webpage. A check mark appears next to the current mode of the document. Changing the mode causes the webpage to refresh, and remains in this mode until another mode is chosen or the browser is closed.

Navigating the F12 Developer Tools Interface (emphasis in original)

If you'd like confirm this answer, open up a new browser window and navigate to http://stackoverflow.com. You should note in the F12 Developer Tools that it loads with a Document Mode of "Standards" (IE9 Standards if you're in IE9).

Switch Stack Overflow's Document Mode to IE7 Standards and refresh the browser. After refreshing you'll find that the browser stays with Document Mode: Internet Explorer 7 Standards, and lists Internet Explorer 9 Standards as (Page Default).

enter image description here

Compatibility View Settings

According to the MSDN resource How Internet Explorer Chooses Between Document Modes, the only other potential cause for this would be Compatibility View Settings.

In Internet Explorer 9, click Tools, then Compatibility View Settings. You can find your settings for Intranet sites there. In Internet Explorer 10 (Desktop Mode), you may have to press Alt to reveal the Tools menu item.

enter image description here

Packing answered 3/4, 2013 at 18:29 Comment(7)
AS I stated, I did use the <!DOCTYPE html> mode, and I added the <meta http-equiv="X-UA-Compatible" value="IE=Edge"> tag....Every time I open the site it opens in IE7 document mode...I can change it manually, but when I open IE again (not just refresh IE)..the page opens as an IE9 document. Sorry but I don't consider this an answer.Greater
@Greater I understand you're using <!DOCTYPE html>; I was reassuring you that this was an appropriate approach. If the browser says IE9 is the Page Default, that means it is being overridden in the tooling. In my example at the end of the answer I pointed out how you can achieve the same results with StackOverflow.Packing
ok..maybe I'm still missing something..but if this is an appropriate approach, how can I get my site to open in IE9 document mode (by 'tooling' I think you mean manually resetting the document mode using F12?)? Is adding code server-side the only way? (This is on a development server btw)Greater
@Greater If the tooling is overriding the default document mode, then the server isn't relevant at this point any longer. Just press F12, to reveal the tools, and then manually switch the Document Mode back to the Page Default (which is Internet Explorer 9 Standards, right?) and you should be good. If you close the browser, and open it again to find Internet Explorer 7 Standards, it may be that Compatibility View Settings are taking control, in which case you should check Tools > Compatibility View Settings to see what your setup is there.Packing
Uncheck everything within the Compatibility View Settings, and make sure the Compat View Icon is not blue (torn paper to the right of the address bar). With those items unchecked, and the paper grey, restart the browser. When you open the browser again, is the paper blue? And is the document mode something other than the Page Default?Packing
sorry, I deleted my last comment b/c I realized I had not in fact tried every combo...and you were right, the torn paper is now grey, I unchecked everything, and it seems to open in IE9, thanks! however this won't help me for all the inter-office folks that I know will not want to do any change of settings on their machine; I still need to make sure that the app opens in this mode on any computer in the office...Greater
@Greater That is out of your control; at this point, it's up to the Network Administrator to ensure the browser understands this url to be an exception to Compatibility View Mode. First of all, make sure that the page is indeed loading in Compat View for everybody else, and from there issue a request to your Network Administrator to make this change for everybody's instance of Internet Explorer.Packing
P
5

Just put following code and your IE browser would open by default in defined compatible view.

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

You can change "IE=EmulateIE9" to "IE=EmulateIE8" if you want make IE8 as default compatibility view.

<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8"> 
Phila answered 17/10, 2013 at 6:19 Comment(0)
G
0

The issue in my case was that a group policy had been applied on my company-issued laptop which explicitly set the domain that I was using to render in Compatibility Mode. I found this by checking the IE console (F12):

enter image description here

And I verified this by running the following command on my machine, which generated a report of applied group policies on my machine:

gpresult /h C:\gpresult.html

The report had a section like this, which included the root domain of the website I was working on:

enter image description here

Gabriel answered 19/9, 2017 at 16:34 Comment(0)
L
-1

You can put the following code sample too.

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

This will load your application in the default browser mode. And specially make sure to include this meta tag as the first tag just after the head tag. Other wise it will not work.

Lambda answered 11/6, 2014 at 6:17 Comment(1)
I have this exact tag in my original question.Greater

© 2022 - 2024 — McMap. All rights reserved.