On our site we currently have approx. 50% of our IE7 users running Windows 7. However, Win7 was released with IE8 meaning that something is not right. Based on this, we made the assumption that the modern IE browsers enter IE7 compatibility mode on our site. So we placed the "X-UA-Compatible=edge" meta tag on our site in hope to kill off IE7 support. However, after a week, the percentage of IE7 (and IE8) users have gone up for the first time since the start of this year. When looking at the X-UA-Compatible documentation, it is meant to be used for putting your site into an older mode.

  • Is there any other way to make sure that IE doesn't enter compatibility mode?
  • Is there something else we need to look for?

And yes, we have so many users on our site that we can't kill off IE7 until it goes down under 2% of unique visitors.

EDIT: We use <!doctype html>

EDIT2: We haven't been able to reproduce the compatibility mode in our environments either

  • What are you using to collect this data, such as browser type. Apr 15, 2013 at 11:35
  • We use XiTi by AT Internet, it's pretty much an alternative to Google Analytics
    – Skurpi
    Apr 15, 2013 at 11:53
  • If i remember correctly, IE sometimes falls back if the HTML is not valid. You could check your pages with the W3 validator. Whether your page is loaded in compatibility mode you can check easily yourself, open your page in IE and press F12 to enter the developer tools. Apr 15, 2013 at 12:31
  • @martinstoeckli We haven't been able to reproduce it on our windows machines. Whenever we look it just shows the proper IE version, no compatibility mode.
    – Skurpi
    Apr 15, 2013 at 13:06
  • Might help if you provide the website in question. Apr 15, 2013 at 14:13

2 Answers 2


Ok, so we have confirmed that our calculations were incorrect. Our provider was giving us reports based on the number of "visits". A visit is calculated based on the amount of time a user spends on our website. However, IE7 users might be rare but they might spend more time on a website compared to a Chrome user. This meant that the percentage we were going by were not based on the percentage of users with a browser, but something like "how much time does a user spend on our site, based on the browser they use".

We finally decided to drop support for IE7. The calculation was simple: The amount of time our team spends to adjust the site for IE7 does not weigh up the amount of revenue we get from the same users. It's worth noting that we won't be going through our code in one go and removing all fixes we have for IE7. Instead we will be doing it over time as part of our daily work. This means that the site will still work for IE7 for a long period of time with only minor glitches. But hopefully by the time the site is unbearable in IE7, the last few percent of users will have upgraded.

The actual solution to the problem:

In order to reduce the number of users in compatibility-mode, we tried using the X-UA-Compatible=edge flag. The flag can be set using both a HTML tag and as a request header. We tried both, but that didn't affect our numbers to a noteworthy level. If a site has once ended up in a old browsers compatibility-mode then it stays there until the user actively selects to go to normal browsing. To come around this we decided to do the same thing as Google+ when users are in the same jam: Show a bar at the top of the page for each time the page is loaded. This bar contains a link to information on how to exit Compatibility mode for a website, and the bar will not go away until they do.

To check if a user is surfing in compatibility mode:

var ua = navigator.userAgent.match(/MSIE [0-9]*/);
var version;

if (ua && document.documentMode !== undefined) {
  version = parseInt(ua[0].replace(/[^0-9]/g, ""));
  if (version !== document.documentMode) {
    alert("Compat mode!");

(solution based on other stackoverflow questions. Amongst others: this and this)


Is there any other way to make sure that IE doesn't enter compatibility mode? Yes. Use a doctype that makes the browser go into standards mode.

<!DOCTYPE html>

should do the trick

  • We are using this already
    – Skurpi
    Apr 15, 2013 at 9:59
  • In that case, I would check - open up your site in IE9 and press F12. Does it say you're in compatibility mode?
    – dave
    Apr 15, 2013 at 10:06
  • We haven't been able to reproduce the compatibility mode in our environments either. IE9 (and IE10) both say their current version in standards mode
    – Skurpi
    Apr 15, 2013 at 10:55
  • In that case, I would assume that the issue isn't that the site is going into compatibility mode, but that your detection of Windows 7 is not working correctly. What do you do to detect the windows version?
    – dave
    Apr 15, 2013 at 20:27
  • Like I said, an external supplier is supplying the data for us with their javascript (XiTi by AT Internet). We will try to look into how they detect the version.
    – Skurpi
    Apr 22, 2013 at 8:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.