18

When users go on my website, I want to force them to use Internet Explorer 8 non-compatibility mode. If they use compatibility mode, my website doesn't work.

How to force it off? Is it a meta tag?

Edit: Yes, you can do it. The solution is this:

<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8" />
Community
  • 1
  • 1
TIMEX
  • 259,804
  • 351
  • 777
  • 1,080
  • Duplicate: http://stackoverflow.com/questions/2064702/force-ie8-not-to-use-compatibility-view – Kevin Crowell Mar 09 '10 at 19:33
  • Does your site not work in IE7? Or is there some difference between IE7 & IE8 Compatibility mode that is causing the issue? – bdukes Mar 09 '10 at 19:33

6 Answers6

8

You can do it as a tag or as a setting in IIS (with the tag), set to IE=EmulateIE8

Tom
  • 22,301
  • 5
  • 63
  • 96
  • 1
    I might be wrong, but this is not a correct answer -- on that page they discuss how to force the compatibility mode on, not off. – Zhenya Jan 17 '12 at 19:14
  • Sorry, it should be clearer what the tag needs to be. Edited. – Tom Jan 17 '12 at 19:35
  • 1
    Just so people don't get confused this will not work in an Intranet. large corporations and governments can have very big intranets with hundreds of individual sites. Microsoft has decided if your site is in an intranet then you all get stuck with compatibility mode unless each user or group policy says otherwise. a small site owner in a large corporation has almost no control. – DeveloperChris Apr 04 '13 at 01:25
4

You can't force IE into non-compatibility mode.

What you can do is to tell the browser that the page works in IE 8, then it will remove the compatibility button in the address bar. A user can of course still force the browser into compatibility mode, but not with just a click of a button.

See: How to avoid ie8 compatibility button?

Community
  • 1
  • 1
Guffa
  • 687,336
  • 108
  • 737
  • 1,005
1
<meta http-equiv="X-UA-Compatible" content="IE=9" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8" />
<META content="IE=edge" http-equiv="X-UA-Compatible">
<meta http-equiv="X-UA-Compatible" content="IE=8" />
<meta http-equiv="X-UA-Compatible" content="IE=IE9" />
<meta http-equiv="X-UA-Compatible" content="IE=Edge" />

all and any of it might help but it all depend on your script. You do not need to use all it is just different way to say it. it depend on script that you use on site

1Webmaker
  • 11
  • 1
1

You need remove port number from your domain site name site:1180/index/

If browser see port number in url - hi "think", that's is intranet.

setup your dns server for friendly urls - site.com/index and it work OK

ZOXEXIVO
  • 920
  • 9
  • 21
0

Here is some JS that helps

Code in the following condition runs only in IE7 and lower: The below code works if the user is on IE7 or even in IE 8 (Compatibility View only) then you can navigate them to your Error Page.

if (document.all && !document.querySelector) {
 alert('you are on IE7 or lower');
 window.location.href = "URL";
}

The next one runs in IE8, but not in IE7 or IE9+:

if (document.all && document.querySelector && !document.addEventListener) {
alert('you are on IE8');
window.location.href = "URL";
}
Dextere
  • 281
  • 1
  • 3
  • 13
-1

I would recommend against doing this, even if you can find a way to do it. Compatibility Mode is a setting the user is meant to have control over. You shouldn't be changing it out from under the user.

You should either fix your site to work with compatibility mode, or just tell your users not to do it.

John Saunders
  • 160,644
  • 26
  • 247
  • 397
  • @Johannes: I took it that he was talkling about the new "Compatibility View" feature of IE, which is plainly a user feature. What do _you_ think he's asking about? – John Saunders Mar 09 '10 at 19:36
  • 2
    @Johannes: I always comment before the downvote, then do the downvote. – John Saunders Mar 09 '10 at 19:36
  • 2
    The same, actually. And the HTTP header X-UA-Compatible is intended to toggle *exactly that* without user interaction. It's intended for site authors to avoid having users to fiddle with the settings until the site looks right. It's a per-page setting, though and therefore won't do any harm if set by the site. After all, styles are also not universal :-). Hm, ok, actually the original complaint to this answer still remains. – Joey Mar 09 '10 at 19:37
  • @Peter: editing to correct the spelling would have been better. – John Saunders Mar 23 '11 at 17:15
  • down vote because compatibility mode breaks websites. Users should not need to worry about this sort of thing and only invoke it if necessary and they know what they are doing. its the site developer who is responsible for making the site compatible (as you stated) but he/she should also be able to overrided Microsoft's goofy decision to make compatibility mode a blanket setting – DeveloperChris Apr 04 '13 at 01:20
  • Nonsense. You clearly haven't needed to manage many PCs in a "Corporate" environment, all sharing the same settings. The user may not know about Compatibility mode, but their system admins may have set it for all PCs. – John Saunders Apr 04 '13 at 01:27
  • What I think in nonsense is the idea that people should feel obligated to not use a feature of HTML because a setting exists in IE. Microsoft's own documentation says: "Note that the X-UA-Compatible header has greater precedence than Compatibility View. If a website is on the Compatibility View List and a page on that site includes an X-UA-Compatible header telling Internet Explorer to display a page in IE9 mode, the page is displayed in IE9 mode. This allows web developers to support standards mode on an incremental basis." The user was *never* given control over that precedence. – neverfox Oct 09 '14 at 01:45
  • If the sysadmin is knowledgeable, they will know that the setting is only a default for cases when no X-UA-Compatible header is available. It's not, nor was it meant to be, an override of developer intentions. – neverfox Oct 09 '14 at 01:47