Why does IE9 opens in Document Mode as IE7 standards? - html

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

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" />

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.

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>

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.

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"

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.

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.

Related

<meta http-equiv="X-UA-Compatible" content="IE=Edge" /> is not working in IE 11

In our application we are using <meta http-equiv="X-UA-Compatible" content="IE=Edge" /> as the first line of code inside <head>tag. In Local and QA it is working fine, but when we try to open PROD in IE we are facing some problem - it is opening in document mode 7. In IE EDGE it is working fine, we are facing this issue in IE 11.
What might be the problem?
If:
The production environment is in the Intranet zone (right-click and then choose Properties), and
The page does not contain a <!DOCTYPE> directive, and
The Default settings have not been changed
(Other factors may also be involved.)
Then, the page is likely loading in IE7 Compatibility mode by design.
If you cannot change the page to include the HTML5 doctype directive (<!DOCTYPE html>), then you might see if the web server can serve the x-ua-compatible header with the page.

How can I make my HTML5 website render in latest IE version AND be W3C Compliant?

Unfortunately I had the problem with my HTML5 website, where my Internet Explorer browser (I'm on version 11) decided it was the right thing to do to load the website in IE7 compatibility mode.
Insert annoyed face
Adding this <meta http-equiv="X-UA-Compatible" content="IE=edge" /> to the website does make it work correctly in IE, however if you put the website through the W3C Validator, it throws this error at you:
Line 6, Column 59: Bad value X-UA-Compatible for attribute http-equiv
on element meta.
I want to know if anyone knows if there's a way of having the best of both worlds?
It may be a little late for a contribution, but maybe someone can use it. Based on the fact that <meta http-equiv="..." content="..."> is used to simulate an HTTP response header (see here), if you have access to a scripting language like PHP, you could try something like this:
<?php
header('X-UA-Compatible: IE=edge');
?><!DOCTYPE html>
<html lang="en">
...
That way, the server still sends the header, but it's not in the HTML5 code itself. I used this on my website and it validates correctly on the W3C validator. I'm not sure about it having the expected results with IE rendering. Maybe someone can give feedback. My experiments are not too conclusive. I did find some small differences between using the PHP header function and using the meta tag when I tested a page in http://netrenderer.com/.
As I was on a local website, I had to un-tick the Display intranet sites in Compatibility View:
Alt+T > Compatibility view settings
The other option I found which has helped for my published project was to add some code in web config file:
<system.webServer>
<httpProtocol>
<customHeaders>
<add name="X-UA-Compatible" value="IE=Edge" />
</customHeaders>
</httpProtocol>
</system.webServer>
This is obviously IIS on Windows, but you can apparently achieve this on Apache.

Forcing IE 11 to behave as IE 10

We've run into an unusual bug with Internet Explorer and we need to force IE 11 to behave as IE 10 (since this bug is not present in IE 10).
I have tried the following:
<meta http-equiv="x-ua-compatible" content="IE=10">
but unfortunately this does not work and I have not found anything relevant or helpful from Google searches or the docs. So how do we get IE 11 to behave as IE 10?
Do the following:
The correct meta string is:
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE10"/> (I added it just below the <title>. Preserve case, IE crappy code might be also case sensitive.)
And a valid <!DOCTYPE... must be present at the very 1st line of your page (no space or lines before it)
You can verify if it works by hitting F12 to show the IE11 developer tools. On the left side there is a grey bar, scroll it down and select Emulation, if it shows Document mode: IE10 it will be fine!
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE10">
Should work.
I know this will not set IE11 to IE10 mode but it might me worth a shot to try the edge setting.
<meta http-equiv="X-UA-Compatible" content="IE=edge">
This flow chart shows how the document mode works. The image is from the Microsoft MSDN site. http://msdn.microsoft.com/en-us/library/ff955275%28v=vs.85%29.aspx
Another useful link MSDN IE document modes http://msdn.microsoft.com/en-us/library/ff406036(v=vs.85).aspx
I just had the same problem. Its as if the x-ua-compatible tag does not change the document mode unless its the first meta tag in the header. I had a script tag above it.
If you put the meta tag you tried as the first tag in the header and press F12, you will see the document mode stays on 10.
This may help you to set response header with IIS: http://msdn.microsoft.com/en-us/library/ff955275(v=vs.85).aspx
I also tried this, it doesn't works for me
<meta http-equiv="x-ua-compatible" content="IE=10">
also its works well if i manually change Useragentstring in F12 IE console to IE10,
I got a solution here below and its works for me, now my pages works properly in IE11 without changing anything in my code
Refer this
https://stackoverflow.com/a/20422240/2089963
Setting in we.config:
<system.webServer>
<httpProtocol>
<customHeaders>
<clear/>
<add name="X-UA-Compatible" value="IE=EmulateIE9"/>
</customHeaders>
</httpProtocol>

How to force IE10 to render page in IE9 document mode

I have two questions:
How can I force IE10 to render in IE9 document mode? Currently it's rendering my page in Standard document mode.
In IE10's developer toolbar, I am not able to see the option of document mode of IE10. Is it not implemented, or is my browser version is out of date?
Thanks for all your help.
Edit: thanks everyone for the solutions provided. Earlier I was using a meta tag
<meta http-equiv="x-ua-compatible" content="IE=edge" >
just to make sure that IE will render the page in highest document mode, but I was facing some issues with IE10 standard mode, so I changed the meta tag to render the page in IE9 mode:
<meta http-equiv="x-ua-compatible" content="IE=9" >.
You should be able to do it using the X-UA meta tag:
<meta http-equiv="X-UA-Compatible" content="IE=9" />
However, if you find yourself having to do this, you're probably doing something wrong and should take a look at what you're doing and see if you can do it a different/better way.
Do you mean you want to tell your copy of IE 10 to render the pages it views in IE 9 mode?
Or do you mean you want your website to force IE 10 to render it in IE 9 mode?
For the former:
To force a webpage you are viewing in Internet Explorer 10 into a particular document compatibility mode, first open F12 Tools by pressing the F12 key. Then, on the Browser Mode menu, click Internet Explorer 10, and on the Document Mode menu, click Standards.
http://msdn.microsoft.com/en-gb/library/ie/hh920756(v=vs.85).aspx
For the latter, the other answers are correct, but I wouldn't advise doing that. IE 10 is more standards-compliant (i.e. more similar to other browsers) than IE 9.
You can tweak the Registry if you want to make changes only to your own system. If you have IE10 and lots of web sites you visit don't render properly in IE10, then you can tweak your registry to force IE to open in IE9 mode.
HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION
Create a DWORD as iexplore.exe and give value 9999. Restart your IE and it will open in IE9 mode :)
Thanks to my colleague Sreejith D :)
I haven't seen this done before, but this is how it was done for emulating IE 8/7 when using IE 9:
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE9">
If not, then try this one:
<meta http-equiv="X-UA-Compatible" content="IE=9">
Add those to your header with the other meta tags. This should force IE10 to render as IE9.
Another option you could do (assuming you are using PHP) is add this to your .htaccess file:
Header set X-UA-Compatible "IE=9"
This will perform the action universally, rather than having to worry about adding the meta tag to all of your headers.
By what this says, IE10 (the article is referred to a preview release, anyway) it's able to use X-UA-Compatible only if the document is in quirks mode (no DOCTYPE), otherwise IE10 won't react to the request.
Here's an excerpt:
Thus, to make IE10 react to the X-UA-Compatible directive, one must either create a page that triggers quirks-mode per the rules of HTML5 (that is: an a page with no doctype). One can also send the directive as a HTTP header, however: A HTTP sent directive appears to have no effect if you use it to downgrade the rendering — it can only be used to upgrade the rendering
So, you've to do it manually with Dvelopers Tools, or with quirks mode (but I suggest to stay in IE10 mode which is for the first time aligned to the other browers' standard)
EDIT: The follows are some useful link to read:
http://msdn.microsoft.com/en-us/library/cc288325(v=vs.85).aspx
http://msdn.microsoft.com/en-us/library/jj676915(v=vs.85).aspx
http://blogs.msdn.com/b/ie/archive/2011/12/14/interoperable-html5-quirks-mode-in-ie10.aspx
You can force IE10 to render in IE9 mode by adding:
<meta http-equiv="X-UA-Compatible" content="IE=9">
in your <head> tag.
See MSDN for more information...
there are many ways can do this:
add X-UA-Compatible
tag to head
http response header
using IE tools F12
change windows Registry
The hack is recursive. It is like IE itself uses the component that is used by many other processes which want "web component". Hence in registry we add IEXPLORE.exe. In effect it is a recursive hack.
I found this post while I was looking for a solution to my DNN6 website.
The error was
SCRIPT5007: Unable to get property 'documentElement' of undefined or
null reference
But I needed the same solution: force compability mode to IE9. So let me share with you what I did to solve this.
So, for DotNetNuke 6 users try the StyleHelper SkinObject
Worked great for me!

Force "Internet Explorer 8" browser mode in intranet

There are "Internet Explorer 8", "Internet Explorer 8 Compatibility Mode", and IE7 mode in IE8.
However, the default setting in IE make all intranet website use "IE8 Compatibility Mode" even I have setted doctype, the meta tag, http header as suggested to force it into IE8 mode.
I have
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
and
<meta http-equiv="X-UA-Compatible" content="IE=8" >
But it still goes into "IE8 Compatibility Mode", without any changes in IE setting.
How to force it into pure "IE8" mode, without change any browser's setting?
PS. I am not talking "document mode" here.
Seem that MSFT has not consider a large intranet environment that we have many different web application running inside.
There is no way to bypass the IE8 setting, according to somewhere I read on MSDN forum.
So, I will have to beg my system administrators to put some new group policies to change "Compatibility View" setting and the value and prevent user change the value, until MSFT discover this bug and fix it.
From an MSDN blog post (emphasis theirs): "Browser Mode is chosen before IE requests web content. This means that sites cannot choose a Browser Mode."
It is possible to override the compatibility mode in intranet. Just add the below code to the web.config. Worked for me with IE9.
<system.webServer>
<httpProtocol>
<customHeaders>
<clear />
<add name="X-UA-Compatible" value="IE=edge" />
</customHeaders>
</httpProtocol>
You'll have to make some adjustments to IE.
Here they are.....
In Internet Options / Local Intranet / Sites
Under : Local Intranet inside Sites, uncheck "Automatically detect intranet network".
Then select only "Include all network paths (UNCs)
See attached screenshots
I found the answers here hard to follow, so here's the important information in a nutshell:
If your intranet uses default settings for IE, IE7 Standards Mode is enforced for intranet sites regardless of any website settings.
From this:
Compatibility View and the Enterprise
A large number of line-of-business
websites are Internet Explorer 7
capable today. In order to preserve
compatibility, Internet Explorer 8
ships with smart defaults based on
zone evaluation. In the default state,
all sites on the public internet
display in Internet Explorer 8
Standards mode (Compatibility View
off) and all intranet websites
display in Internet Explorer 7
Standards mode (Compatibility View
on).
Let’s look at some examples. If you
navigate to sites on your local
intranet like http://myPortal and
http://sharepoint/sites/mySite,
Internet Explorer 8 identifies itself with a User Agent string of
‘7’, Version Vector of ‘7’, and
displays webpages that trigger
standards mode in Internet Explorer 7
Standards mode. This combination
allows webpages that worked correctly
in Internet Explorer 7 to continue to
do so in IE8.
To override the Compatibility View settings for intranet or all websites you need to make IE8 emulate itself.
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8" >
Set a custom HTTP header instead of using the <meta... in the <head> section. These are supposed to be equivalent, but I have seen that an X-UA-Compatible HTTP header from the server will override IE 8's "Display intranet sites in Compatibility View" setting, where the <meta... element would not.
If you are using .NET, I have the answer for you:
HTML:
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=8" >
Web.Config:
<system.webServer>
<httpProtocol>
<customHeaders>
<clear />
<add name="X-UA-Compatible" value="IE=8" />
</customHeaders>
</httpProtocol>
Read somewhere that the DOCTYPE declaration must be the very first line. No comments of any kind, nor empty lines.
In combination with setting the HTTP Response Headers, this worked for me. Browser Mode went from "IE9 Compatibility Mode" to just "IE9 Mode".
HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\BrowserEmulation
IntranetCompatibilityMode 1-->0
In order for the META declaration to work, the doctype has to be the simplified version:
<!DOCTYPE html>
Not the longer statement in Dennis' question.
This combo did the trick for me:
<!DOCTYPE HTML>
<HEAD>
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8" >
</HEAD>
at least IE developer tools reports IE9 Compat View, IE8 standards
just for kicks i tried EmulateIE7 and that worked as well.
simplifying the extended !DOCTYPE was key.
You need remove port number from your domain site name
site:1180/index/
If browser see port number in url - hi "think", that's is intranet.
setup your dns server for friendly urls - site.com/index and it work OK
The answer marked as "correct" is technically correct but suggests that there is no solution to the real issue being faced by most people that is: "how do I properly show on IE8, with compatibility mode enabled, a web application which does not support compatibility mode?".
<!DOCTYPE HTML>
<HEAD>
<meta http-equiv="X-UA-Compatible" content="Edge" >
</HEAD>
this worked for me on several workstations.
If the above code is implemented on application side, IE8 appears to behave as if it was not in compatibility mode, even though it will still show browser mode as compatibility mode.