Misunderstand of <meta http-equiv=”X-UA-Compatible“ content=”IE=edge“>

16,526

Solution 1

"1) If some users have some version of IE and he try to open concrete page, the page will be open in the version of IE Which user have (the latest version). I do not understand why we need that tag to maintain that?"

IE 8* and later come with multiple rendering engines built in. Which one IE chooses to use for a particular page depends on several factors. Sometime it defaults to an older mode, so even if you're using IE10 it may open a particular page in, say, IE7 compatibility view.

If you are using a standard html5 doctype on your page, like <!DOCTYPE html>, then you would think you wouldn't have to worry, and on the intERnet that is more or less true. But, for reasons that make no sense to anybody outside Microsoft, if IE is opening a page on an intRAnet it defaults to an older compatibility view, even if there is an html5 doctype specified.

Using the <META> tag you mentioned tells IE to always use the latest ("edge") rendering engine that it has.

"2) If user explicitly say that his IE (IE9 for instance) want to open the browser page as some previous IE version (for instance IE8) will this meta tag prevent it?"

No. The user can still use the built-in dev tools to change the document mode.

"3) What if I have IE7 or IE8 and this page has a meta tag? That page will be open in IE7 or IE8 Depends which version of browser I have already have as the latest on my computer."

Yes. Of course IE8 can't open a page in IE9 mode. But as I mentioned above that meta tag tells whichever version of IE you're using to use the latest mode that it has rather than (potentially) defaulting to an older mode.

*Or do I mean IE 7 and later? I forget.

Solution 2

See Microsoft documentation:

http://msdn.microsoft.com/en-us/library/jj676915(v=vs.85).aspx

Note: Edge mode is intended for testing purposes only; do not use it in a production environment.

Because it forces all pages to be opened in standards mode, regardless of the version of Internet Explorer, you might be tempted to use this for all pages viewed with Internet Explorer. Don't do this, as the X-UA-Compatible header is only supported starting with Windows Internet Explorer 8.

This means that it is just for quickly testing the latest IE version for a web site that currently is restricted to a specific version.

To permanently use latest version, use HTML5 document type: <!DOCTYPE html> instead.
See in the Introduction in the article:

In most cases, we recommend that websites use the HTML5 document type to support the widest variety of established and emerging standards, as well as the broadest range of web browsers.

EDIT: I just noticed this answer in another SO post. This indicates that if the user for some reason is running IE in compatibility mode for the page, you will override this by setting the X-UA-Compatible=EDGE. This means that if you know that your page will be displayed best using the latest standards, you can force IE to run in edge mode even if the user has activated compatibility mode. See the other answer for details on different ways compatibility mode can have been activated.

As a bonus effect on this, IE will also hide the compatibilty button in the address bar when yo have set X-UA-Compatible=EDGE.

Solution 3

live with its pointless-ness...

As said by others, not using this tag brings up (at least in IE9) the compatibility view icon in the address bar (a symbolic broken page icon, next to reload and stop). Also on perfectly W3C-validating <!DOCTYPE html> html5 pages. Seeing this icon could trigger users to press it. And that indeed leads to quirks mode, so the padding<=>width calculation changes to the old days and your page looks bad. (Well done, M$, this really helps...)

Thus this tag helps to suppress it.

google.com also uses the edge flag (Though they strongly advocate 'proper' html5, eh?) nytimes.com doesn't use the edge flag. And -boom- there's the compatibility flag.

Looking closer at html5-promoting sites... html5boilerplate.com doesn't have the icon, doesn't have the meta tag, but therefore it's in the http header.

in short: Looks like there's no good way around it. A non-userfacing, superficious/ugly flag is better than anything user-facing in danger of making your page look worse or seemingly invalid (as an end-user that's what I would conclude, whenever offered any 'compatibility view' of sorts).

Solution 4

You can explicitly tell IE browsers to use its latest available rendering engine using a meta tag. This also prevents IE to open Quirks mode while rending page.

Check this out: http://technowide.net/2013/06/21/forcing-ie-browsers-to-behave-properly/

Solution 5

You can add this to your .htacces

<IfModule mod_headers.c>
    Header set X-UA-Compatible "IE=edge"
    # `mod_headers` can't match based on the content-type, however, we only
    # want to send this header for HTML pages and not for the other resources
    <FilesMatch "\.(appcache|crx|css|eot|gif|htc|ico|jpe?g|js|m4a|m4v|manifest|mp4|oex|oga|ogg|ogv|otf|pdf|png|safariextz|svgz?|ttf|vcf|webapp|webm|webp|woff|xml|xpi)$">
        Header unset X-UA-Compatible
    </FilesMatch>
</IfModule>
Share:
16,526
Milos
Author by

Milos

Updated on June 27, 2022

Comments

  • Milos
    Milos almost 2 years

    I can not realize the real point of the meta http-equiv="X-UA-Compatible" content="IE=edge.

    1) If some users have some version of IE and he try to open concrete page, the page will be open in the version of IE Which user have (the latest version). I do not understand why we need that tag to maintain that?

    2) If user explicitly say that his IE (IE9 for instance) want to open the browser page as some previous IE version (for instance IE8) will this meta tag prevent it?

    3) What if I have IE7 or IE8 and this page has a meta tag? That page will be open in IE7 or IE8 Depends which version of browser I have already have as the latest on my computer.

    I really can not see purpose of this meta tag (except situation that user already adjust new version of the browser to open a page as older version), or I missed something here.