Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to force compatibility mode for all versions of IE?

My project support IE8 to IE10. We try to use standard code and support Standard Mode for all IE Versions.

We use the following to force IE to open in the latest mode:

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

But for some case we need to force IE to open site in Compatibility mode. Like when user opens the site in IE10, it should open in IE10 Compatibility mode. When user open site in IE9, it should open in IE9 comptibility and so on for IE8.

Is this even possible to force compatibility mode or we can only force the document mode and not the browser's compatibility mode?

If its possible, is it possible to have a generic statement for all IE versions and not IE version specific syntax like given in post linked when it fores IE8 to IE7 Emulation: Force IE8 Into IE7 Compatiblity Mode

like image 261
Pawan Pillai Avatar asked Jul 13 '13 07:07

Pawan Pillai


1 Answers

Compatibility mode is meant to help users with old products that are not up-to-date. In no way it should help the developer to avoid the issues he may find.

Unless you absolutely have no choice (for example a broken dependency like SharePoint...) or want to expose a serious lack of competence, you should not force a user to see your page in compatibility mode.

If you need to support all IE versions, you must understand how each version works and be aware of each differences in order to make a code that can result in the same output no matter the version.

If the idea of mastering "crappy versions" (for example IE6 and older) sounds really bad to you, I would advise you to establish a threshold to concentrate on the compatibility with some old versions, rather than all of them.


EDIT: But if you really need to force compatibility mode, you can use the "X-UA-Compatible" meta tag. For example:

<meta http-equiv="X-UA-Compatible" content="IE=9" />
like image 107
Frederik.L Avatar answered Dec 14 '22 23:12

Frederik.L