Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why use X-UA-Compatible IE=Edge anymore?

I've taken several online courses lately and I still see some instructors add the following meta tag to the top of their documents by default:

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

The thinking appears to be that this is just as important and useful as <meta charset="UTF-8">.

But why?

According to Microsoft's Modern.ie documentation it's "best practice" which "ensures Internet Explorer uses the latest engine". Ok, fair enough.

However, if you follow the flow diagram on MSDN it clearly shows that a document without X-UA-Compatible information is forwarded to the user's "Compatibility View" preferences, and if that's not set then just follow the !DOCTYPE declaration.

In other words, unless the user has some Compatibility View settings in place, IE will just follow your !DOCTYPE and use the latest standards mode of your browser for rendering anyway... No need for a X-UA-Compatible IE=Edge statement at all.

As MSDN says: "Use the HTML5 document type declaration to enable edge mode".

So in what circumstances is X-UA-Compatible IE=Edge needed?

like image 492
Chuck Le Butt Avatar asked Oct 13 '14 18:10

Chuck Le Butt


People also ask

What is the purpose of meta http equiv X-UA-Compatible content ie edge?

The X-UA-Compatible meta tag is a http-equiv meta tag. X-UA-Compatible Meta Tag Recommended Uses: Use the X-UA-Compatible meta tag on web pages where you suspect that Internet Explorer 8 will attempt to render the page in an incorrect view. Such as when you have an XHTML document with an XML declaration.

Is internet explorer 11 still supported?

Internet Explorer (IE) 11 is the last major version of Internet Explorer. On June 15, 2022, the Internet Explorer 11 desktop application is no longer be supported on certain versions of Windows 10*. Customers are encouraged to move to Microsoft Edge, which provides support for legacy and modern websites and apps.

Is internet explorer still supported?

After 25+ years of helping people use and experience the web, Internet Explorer (IE) is officially retired and out of support as of today, June 15, 2022. To many millions of you, thank you for using Internet Explorer as your gateway to the internet.


3 Answers

In theory, including <meta http-equiv="X-UA-Compatible" content="IE=edge"> forces IE to display your HTML using "Standards Mode" (as opposed to "Quirks Mode"), making it more inline with other modern browsers.

However, as @David's answer points out, unless you're hosting a site in the "Local Intranet" zone, there is very little reason to include it and, according to Microsoft's best practice recommendations, absolutely no reason to include it in the HTML itself. (You should place it in your server config or site headers.)

If you are considering using X-UA-Compatible anywhere in your project, you should remember that the "Compatibility View" logic which uses it is only included in IE8, IE9 and IE10. (It was only introduced in IE8 and was disabled in IE11.)

Also be aware that IE11 is the only officially supported version of IE at this time (EOL support is scheduled for June 15, 2022). All older versions of IE should be considered insecure and not be used.

If that wasn't enough reason to convince you not to use it, consider that Microsoft state that IE8 and above already automatically render in Standards Mode when a <!DOCTYPE is present, making it even more pointless.

You can see for yourself the flow that IE takes to decide what document mode to use:

enter image description hereenter image description here

As you can see, if no X-UA-Compatible meta tag or HTTP header is present, it checks the user's "Compatibility View" settings. If the user doesn't have any for your website, IE then checks for the presence of a <!DOCTYPE declaration. If it finds one it automatically uses the latest Standards Mode (aka "EmulateIEx"). If it doesn't, it reverts to Quirks Mode.

Even more reasons why you shouldn't use the "X-UA-Compatible" meta tag from Microsoft themselves (emphasis mine):

When Internet Explorer encounters the X-UA-Compatible META tag it starts over using the designated version's engine. This is a performance hit because the browser must stop and restart analyzing the content.

In other words, It slows initial page render

The X-UA-Compatible directive is a tool to allow applications to work in the latest Internet Explorer version while updates are made to the application.

It was only ever designed for temporary use.

The best practice is an X-UA-Compatible HTTP Header. Adding the directive to the response header tells Internet Explorer what engine to use before parsing content begins. This must be configured in the web site's server.

In other words, there's better ways of implementing X-UA-Compatible if you absolutely need it.

Starting from 12 January 2016, only the most current version of Internet Explorer available for a supported operating system will receive technical supports and security updates. Internet Explorer 11 is the last version of Internet Explorer, and will continue to receive security updates, compatibility fixes and technical support on Windows 7, Windows 8.1 and Windows 10.

IE11 is the only officially supported version of IE.

The only reason to include the X-UA-Compatible meta tag in your HTML was to override a user's "Compatibility View" settings in IE8, 9 and 10 for your website. In almost every case the user will not have changed these settings (why would they?), and now those browsers are not even supported anymore.

In short: You should never need to include this tag.

like image 181
Chuck Le Butt Avatar answered Oct 17 '22 10:10

Chuck Le Butt


If the user is browsing a page located in the "Local Intranet" zone (such as on a corporate intranet), the "compatibility view" is turned on by default. This is when I have used "X-UA-Compatible" to force IE to use the latest engine.

like image 21
David Avatar answered Oct 17 '22 11:10

David


As long as it is set to “Edge” it validates as HTML5, and I'm told it only causes IE to re-render the page if the site was already rendering it in Compatibility mode. Still, putting it in the server config (.htaccess, etc.) is better than putting in the HTML of each page.

like image 1
Michael McGinnis Avatar answered Oct 17 '22 09:10

Michael McGinnis