IE Compatibility Mode: 'X-UA-Compatible' tag 'Edge'

90,611

Solution 1

That tag will try to force the browser to use the latest rendering mode the browser supports. It will not trigger Compatibility mode.

Note that the tag has to be the first tag in the head or it will not work. This fact favors using HTTP headers if possible as the order in the HTTP headers does not matter.

If the browser stills ends up in Compatibility mode when you use a header or the meta tag one of these things is likely the cause:

  • you are missing a sane doctype
  • the browser has been set to always use compatibility mode
  • the site is hosted on an "intranet site" and the default setting for intranet sites is set

Changing the browsers Compatibility View settings

Microsoft considers at least 192.168.x.x to be on a "Intranet site". The default for intranet sites in IE8/IE9 is to use compatibility mode. That's a huge issue for many business applications as the programmer CANNOT override this option even with this meta tag. ("Display intranet sites in Compatitiblity View" is not overridable by meta tag or http header - the browser is in complete control of compatibility view in this case)

Compatibility View Settings

Always add this meta tag or an http header?

One more good thing about using this meta tag is that the "compatibilty view" icon is removed from the address bar of the browser. At least your users can then not decide the render mode using that button.

Solution 2

Even if you have unchecked the "Display intranet sites in Compatibility View" option, and have the X-UA-Compatible in your response headers, there is another reason why your browser might default to "Compatibility View" anyways - your Group Policy. Look at your console for the following message:

HTML1203: xxx.xxx has been configured to run in Compatibility View through Group Policy.

Where xxx.xxx is the domain for your site (i.e. test.com). If you see this then the group policy for your domain is set so that any site ending in test.com will automatically render in Compatibility mode regardless of doctype, headers, etc.

For more information, please see the following link (explains the html codes): http://msdn.microsoft.com/en-us/library/ie/hh180764(v=vs.85).aspx

Share:
90,611
Jonathan
Author by

Jonathan

Updated on July 09, 2022

Comments

  • Jonathan
    Jonathan almost 2 years

    I have this in the <head>:

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

    It will force the latest rendering mode for IE, but is Compatibility Mode considered the last one?

    I mean, for example: using this code with IE8, it will force it to use IE8 or IE8 Compatibility Mode?

  • Rasmus Kaj
    Rasmus Kaj over 12 years
    Would you care to clarify that of link to something describing this? In cases I've seen, you either specify IE=8 (or some other number) requesting a behaviour in IE close to that of IE8, or you specify IE=edge to request the native behaviour of the actual version used in IE.
  • unclenorton
    unclenorton over 12 years
    @Rasmus, the point is, you actually can specify multiple modes. Here is the related discussion (more links inside): stackoverflow.com/questions/3413629/…
  • Kees C. Bakker
    Kees C. Bakker over 11 years
    According to this ie.microsoft.com/testdrive/ieblog/2010/Mar/… it should be overridable by a header.
  • derickito
    derickito over 11 years
    Edge is used so that the user cant enable compatibility mode. It's very helpful in normalizing IE's behavior. Compatibility mode can break certain things (like layout or javascript) and Edge can help you avoid this all together. If you don't specify the meta tag the user can chose compatibility mode and can break your page
  • oldwizard
    oldwizard over 11 years
    I've tried HTTP headers as well, if the page was served from an "intranet site" the header did nothing to remove Compatibility Mode if the "Display intranet sites in Compatibility View" checkbox is checked. If you get it to work with a header I would very much like to know how you did it to improve things over here as well. :)
  • Kees C. Bakker
    Kees C. Bakker over 11 years
    I've created an Asp.Net dll to fix it for an international client that was on the MS list. What language do you use?
  • oldwizard
    oldwizard over 11 years
    Nice, and it works if the server is hosted in the 192.168.x.x range? C# or vb doesn't matter.
  • Justin Skiles
    Justin Skiles about 11 years
    The third bullet is incorrect. I am using IE8 with "Intranet sites in compatibility mode" enabled, but the meta tag is overriding that setting properly.
  • oldwizard
    oldwizard about 11 years
    Are you hosting the site on 192.168.x.x. range? Localhost/127.0.0.1 is not considered to be intranet, and is not forced to run in compatibility mode with that checkbox.
  • donohoe
    donohoe about 11 years
    Not sure about the down-votes. unclenton is accurate and his comments explains his point very well. My use case: I want IE8 to render under IE7 but I don't want to force IE9 and 10 to do the same.
  • oldwizard
    oldwizard about 11 years
    Downvotes are likely due to what derickito said: "Edge is used so that the user cant enable compatibility mode". It's an important feature so that users don't accidently break your page by clicking that stupid compatibility button in the address bar by mistake.
  • Sam
    Sam about 11 years
    IE displays intranet sites using IE7 document mode. IE=Edge (or other settings) overcomes it.
  • Qar
    Qar almost 11 years
    "I mean, if you want IE to use the most recent rendering engine, then just drop the whole meta tag." In my case, the clients server have some headers that make IE use IE7 as document mode. Therefore edge alone, is useful.
  • Gavin.Paolucci.Kleinow
    Gavin.Paolucci.Kleinow about 10 years
    Through testing I've found that the Compatibility View Group Policy setting forces Internet Explorer to use "Mozilla/4.0 (compatible; MSIE 7.0;..." for the user agent of the request, but the X-UA-Compatible IE=Edge meta tag will cause the page to render with the actual user agent of IE. So any server side browser detection will detect IE 7, while client side browser detection will detect the actual version of IE.
  • Craig Tullis
    Craig Tullis over 9 years
    Not overridable? One more reason to absolutely despise IE.