9

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

Community
  • 1
  • 1
Pawan Pillai
  • 1,955
  • 5
  • 37
  • 64
  • 4
    You should NEVER need Compatibilty Mode. Compatibility Mode is intended to make the browser work with OLDER sites that have not been updated yet. – Niet the Dark Absol Jul 13 '13 at 07:04
  • Isn't the IEx Compatibility Mode effectively IE7 emulation mode with only subtle differences in the user-agent string for the statistical purpose? – Ilya Streltsyn Jul 13 '13 at 08:27
  • 1
    @Kolink Yes, we always try to make sites which open in Standard mode. But there is one project which is not yet updated to work with IE10. And it will take some time to update this project. Till then we wanted to force user to open site in IE9 compatibility. Thats why I asked. – Pawan Pillai Jul 13 '13 at 09:39
  • 3
    @NiettheDarkAbsol , there are relevant situations to force compatibility mode I believe. We are having some trouble with Reporting Services and IE 11. Even Microsoft themselves says: ***Unfortunately, using IE11 in compatibility view mode is required for support in all current versions of SSRS.*** Now I'm looking at trying to force the user into compatibility mode instead of sending out instructions. – John Jan 31 '14 at 14:12

1 Answers1

11

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" />
Luke Girvin
  • 13,221
  • 9
  • 64
  • 84
Frederik.L
  • 5,522
  • 2
  • 29
  • 41
  • Thanks, but for some projects, its a requirement until we fix it for IE10. That why I asked, is there any syntax which can really "force" so that IE10 does not open in standard mode. – Pawan Pillai Jul 13 '13 at 09:40
  • 1
    You can try `` but I think it would be better to have an overlay message on IE10 that instruct your user to press F12 and go in compatibility mode until it is fixed for IE10. – Frederik.L Jul 13 '13 at 16:33
  • 3
    @Pawan A few weeks ago, we found a commit with the entire text along the lines of "Fix ___ and ___ in IE8 by forcing IE7 compatibility until we can fix it the right way", from when IE8 was released. That meta tag is still there, and it's required so that IE 8-11 don't break on the old pages, which is restricting what we can do now - so many things were papered over that removing the compatibility mode is too much work. So please, follow this advice: Fix it the right way _now_. – Izkata Nov 14 '13 at 15:40
  • 1
    To the downvote : please manifest yourself on how this answer is wrong and how to improve it :) – Frederik.L Aug 27 '14 at 00:59
  • 10
    The downvote was in response to the attitude in the post. I was working on a SharePoint site, and SharePoint has a bug that causes major issues when editing a page in IE11 (not in IE10, 9, or 8...not in chrome or firefox). I can't change SharePoint's source code, so I need to force the user into compatibility mode until there is a patch for the issue. The "lack of competence" statement bugged me. Insulting people isn't the way to get upvotes. – developering Sep 09 '14 at 22:32
  • @developering Sorry mate, I didn't mean to insult anyone. I only was exposing a fact that compatibility mode is there to help people with old products. In now way it's there to help the developper to workaround some issues he may find. Hence, patching a recent product forcing users to use compatibility mode, IMHO, is showing in some ways, a lack of effort to get the thing working by itself. – Frederik.L Sep 10 '14 at 02:54
  • In fact, it is showing that your product isn't working under normal conditions. Not every dependencies are perfect, , not even the platform. For example, Internet Explorer 6 is really far from being perfect. It's still possible to make great websites compatible with it, by understanding the "issues" you get while using it. – Frederik.L Sep 10 '14 at 03:02
  • @Frederik.L You're absolutely right that it's a terrible solution to force compatibility mode just because you don't want to figure out the real issue. But there are also times (with closed source commercial products) that you don't have another choice. I couldn't put in a ticket with Microsoft and expect them to patch SharePoint by the time my project was due, so this truly was my only way to make it work in IE11. That being said, your answer is correct and your "point" is correct in 99% of cases as well :-) I'll remove the downvote. Thanks for the conversation! – developering Sep 11 '14 at 14:28
  • @Frederik.L Well, I didn't realize that you can't change a downvote after a certain amount of time...so I guess I can't undo the vote. Sorry about that! – developering Sep 11 '14 at 14:30
  • @developering I agree with you that sometimes you don't have the choice. I also think that Microsoft themselves recommend to use compatibility mode (shame on that, they suggest to disable newest feature instead of patching there issues in time). For changing vote, you have to wait until the post is edited. I'll update the post. Thanks :-) – Frederik.L Sep 11 '14 at 18:12