Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I force IE to *not* use compatibility mode?

I have looked through stackoverflow quite a bit and found that the following is the most recommended way to force non-compatibility mode:

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

My issue with these answers is that they are all IE 8 & 9 era answers.

Is this still the way to force to the latest browser that the user is running?

This is for a public site and our users often use IE10, IE9, IE7 & IE8 (roughly in that order).
And yes, IE7 use is more common than IE8.

My only constraint for IE8 is that the site be readable.

It is a modern site, and I want whatever browser the user has to not be in compatibility mode. I know there is a way to specify a browser version, but I'd prefer not to do that with Win10 coming at the end of next month.

If anyone has any info on what Windows 10 will do with this line that would be very useful to know (the new browser is called "Edge").

Thanks for any help that can be provided.

-Chris C.

P.S. I do have the following as the first line (no spaces) of the page:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.0//EN"

"http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd">

like image 342
J. Chris Compton Avatar asked Jun 01 '15 22:06

J. Chris Compton


People also ask

How do I make IE compatibility mode permanently?

Click the Settings and More (ellipsis) button on the top-right corner. Select the Settings option. Click on Default browser. Under the “Internet Explorer compatibility” section, turn on the “Allow sites to be reloaded in Internet Explorer mode” toggle switch to enable IE mode on Edge.


1 Answers

I work on the Internet Explorer and Microsoft Edge team.

What you provided is the x-ua-compat header/meta-tag. It is designed as a hold-over solution to help you move forward and adopt support for modern browsers, without having to immediately take care of modernizing your codebase. It is not meant as a long-term solution for web compatibility.

The best way to give your user the most ideal experience is to first use the HTML5 doctype:

<!DOCTYPE html>

That should be the first thing in your document; nothing should preceed it. From then on, use valid markup alone. Check your document for errors, unbalanced tags, redudant tags, etc. Remember, valid your markup regularly.

Only use the x-ua-compat header/meta-tag when you have legacy code that you cannot immediately replace/remove. In these scenarios, it is permissible to put your users in a legacy document mode:

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

The above will put the browser into Internet Explorer 9's Edge Mode, provided that mode exists. In versions of Internet Explorer prior to 9, the latest document mode will be used.

You can also stack these to show favor:

<meta http-equiv="X-UA-Compatible" content="IE=10,9,7,8" />

But please don't forget my primary message here - the above is meant only as a temporary solution. The ultimate goal is to get your document updated with modern code.

Microsoft Edge, Internet Explorer's successor, does not support document modes. Microsoft Edge will interpret your document like Firefox and Chrome do.

like image 71
Sampson Avatar answered Sep 30 '22 09:09

Sampson