Why does IE9 opens in Document Mode as IE7 standards?
Asked Answered
M

7

67

When I open a webpage in IE9 with DOCTYPE as

<!DOCTYPE html>

It opens Document Mode as IE7 standards.

I need default IE9 standards on opening the page.

How to correct this document mode problem?

A screenshot of how it comes in IE browser developer tool

enter image description here

Malt answered 19/12, 2012 at 10:5 Comment(0)
T
99

Try this answer: https://mcmap.net/q/296963/-mvc-app-causing-ie9-to-use-older-standards.

Summary, give the IE browser more information in the meta tag:

<!DOCTYPE html>
<html>
  <head>
    <title>My Web</title>
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />

Edit Note: As Olly Hodgson mentioned, the proper option is IE=edge, as currently stated in the above snippet. Below is the original, also working version:

   <meta http-equiv="X-UA-Compatible" content="IE=100" />
Teresitateressa answered 19/12, 2012 at 10:9 Comment(13)
You solution works fine. How does this works when IE10 as my browser?Malt
just one note, that meta really must be the first after the title. IE9 works with IE=100. I think that IE10 will work with IE=100. But I did not tested yet ;(Sendal
Gah! Set it to content="IE=edge" to ensure it always uses the latest version of IE!Illgotten
@OllyHodgson Which would be better choice either "IE=edge" or "IE=100"?Malt
IE=edge is Microsoft's way of making sure you always target the latest version, so I'd go with that.Illgotten
@OllyHodgson Both solutions IE=100 and IE=edge works fine for me. I would like to add your answer content="IE=edge" as separate answer instead of given comment. Can you do it in your end or Shall I do it?Malt
@JustinJohn I've changed the answer, with the proper settingsSendal
@RadimKöhler Thank you for your edit. I already suggested an edit in answer earlier, but the suggestion was rejected. That is why I suggested Olly to write a separate answer.Malt
But I don't have opinion to remove IE=100 from answer, as it works fine too.. :)Malt
Done. I just wanted to move the more precise comment into the answerSendal
Thanks @RadimKöhler. I believe all this is getting deprecated as of IE11 anyway (I think it'll still work, but <!DOCTYPE html> will default to standards mode). See msdn.microsoft.com/en-us/library/ie/…Illgotten
The problem with using IE=100 is that when IE101 comes out, your code will no longer be targeting the latest version. So, use IE=edge to always target the latest.Distance
@ChristopherThomasNicodemus Thank you. I am always using IE=edge after reading this answer. Would IE survive in web until IE101 comes, unless a serious non-order IE version bump happens? :)Malt
C
36

There can be multiple reasons why it could be parsing the document under IE7 standard:

  1. The server is sending a X-UA-Compatible header for IE7 in the HTTP response of the document. Check the server response headers using a tool like Fiddler.
  2. The HTML document is setting a meta tag with the X-UA-Compatible property value for IE7.
  3. The page is being detected automatically by IE for opening in "Compatibility view". Note here that by default all intranet sites are viewed in "Compatibility view" in IE. Uncheck the checkbox "Display intranet sites in Compatibility view" under Tools -> Compatibility view settings in IE. The "Display all websites in Compatibility view" should be unchecked too.
  4. You used the Developer tools and explicitly set to view the page to render in "IE7 standards" mode. Note that this will only occur on a per client basis though.

Update 2016-01-28
As @Gordon pointed out in the comments below, another reason can be that the network administrator has set the site for compatibility view as a Group Policy on the network.
The only resolution in that case is to contact the network administrator to remove the site from the Group Policy. See HTML1203 here.

Commissariat answered 19/12, 2012 at 10:12 Comment(7)
I need to force IE9 or greater as standards, my webpage doesn't supports IE < 9 as it is using HTML5.Malt
@JustinJohn Have checked "Compatibility view" settings in IE as I stated? Is it an intranet site? If the page is online can you post the URL?Commissariat
Dang, it was number 3 for me. Thanks Tanzeel, didn't know that setting was there!Pimpernel
Number 3 is what fixed the issue that brought me to this page! I was getting all sorts of rendering problems for all internal web apps.Ogdoad
Excellent... same here.. Number 3 did the trick for me as well. I already had IE=edge.. but was not getting any clue of why it was using IE 7 as default. Compatibility view for intranet sites was the reason.. Unticked.. and that worked.Minerva
It can also be set with a group policy on the network - see HTML1203 here. Apparently nothing you can do in that case.Couperin
Good call @Couperin , I'll add that as an update to the answer.Commissariat
J
7

You can set this in the web.config as well.

<system.webServer>
    <httpProtocol>
        <customHeaders>
            <clear />
            <add name="X-UA-Compatible" value="IE=edge" />
        </customHeaders>
    </httpProtocol>
Jeffcott answered 9/7, 2014 at 20:16 Comment(1)
Putting it here has always been much more reliable for me, the meta tag is very picky and simply having it right at the top of the head (or after title) does not always work.Usable
E
3

Does your page contain the meta tag for forcing IE7?

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

this will force the page to use IE7 compatibility.

Engrossing answered 19/12, 2012 at 10:9 Comment(0)
U
2

Just wanted to share that if your web server is Apache2 you could set the Response header like below in your VirtualHost configuration which will also resolve the issue.

Header set X-UA-Compatible "IE=edge"
Unruffled answered 15/10, 2014 at 16:34 Comment(0)
U
1

The issue appears to be specific to the combination of IE9 and compatibility mode. For us, we cannot disable compatibility mode since it is a SharePoint 2013 site and IE11 must run in compatibility mode to edit pages, but IE9 was behaving as you are showing. Setting the X-UA-Compatible to "IE=edge" in a meta tag did fix our issue, although setting the value to IE=10 did not affect our behavior. We also have the same doctype.

Unidirectional answered 27/8, 2014 at 17:59 Comment(0)
M
1

If your project is ASP.NET MVC, make sure that you add the:

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

tag into your Layout (template) page. I just spent two hours debugging and tweaking, only to realize that I had only added that meta tag into my child pages. As soon as I added it to my layout page, the browser loaded in EDGE mode perfectly.

Mcdougal answered 23/6, 2015 at 17:52 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.