Why does IE9 opens in Document Mode as IE7 standards?
HtmlInternet ExplorerInternet Explorer-9DoctypeHtml Problem Overview
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
Html Solutions
Solution 1 - Html
Try this answer: https://stackoverflow.com/a/13524518/1679310.
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" />
Solution 2 - Html
There can be multiple reasons why it could be parsing the document under IE7 standard:
- 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. - The HTML document is setting a meta tag with the
X-UA-Compatible
property value for IE7. - 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. - 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.
Solution 3 - Html
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>
Solution 4 - Html
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.
Solution 5 - Html
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"
Solution 6 - Html
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.
Solution 7 - Html
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.