46

In IE8, the Microsoft introduced a new mode called compatibility mode which would render the page like IE7.

You can see this button next to address bar in stackoverflow.com. But when you access google.com / live.com, you would not see the compatibility mode button. How do we make sure the pages don't show this button the user?

Ramesh
  • 12,212
  • 2
  • 48
  • 83

6 Answers6

84

Short answer:

Put this in your head tag to tell the browser that your page works in IE 8:

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

Also as per Jon Hadleys comment, to ensure the latest (not just IE8) rendering engine is used, you could use the following:

<meta http-equiv="X-UA-Compatible" content="IE=edge">
Oskar Duveborn
  • 2,159
  • 16
  • 20
Guffa
  • 640,220
  • 96
  • 678
  • 956
  • 13
    To ensure the latest (not just IE8) rendering engine is used, add the following: `` – Jon Hadley Mar 24 '11 at 15:22
  • 5
    Just want to add that the order of elements in header matters. From MSDN: "... it must appear in the header of the webpage (the HEAD section) before all other elements except for the title element and other meta elements." http://msdn.microsoft.com/en-us/library/cc288325%28VS.85%29.aspx – kaptan Sep 04 '12 at 23:16
  • 1
    @kaptan: Good addition. As the browser mode affects how scripts and CSS work, it's logical that it has to come before those. – Guffa Sep 04 '12 at 23:34
  • 1
    You can also add chrome=1 in case the visitor is using Google's Chrome Frame: ``. See [this stackoverflow answer](http://stackoverflow.com/a/6771584/1132838) for a mode detailed explanation. – Lando Dec 05 '12 at 20:48
25

From here:

Sometimes the Compatibility View button isn’t displayed.

The button is located on the address bar next to the ‘stop’ and ‘refresh’ buttons. There are a few cases where there’s no action for a user take and, thus, the Compatibility View button will not show:

If you're viewing an internal-to-Internet Explorer page (such as about:InPrivate)

If you're viewing a page that has declared it's "ready" for Internet Explorer 8 through use of the versioning tag / HTTP header (it doesn’t matter if this tag triggers Quirks, IE7 Standards, or IE8 Standards, the button won’t be displayed)

If you're viewing an intranet page and you have the ‘Display intranet sites in Compatibility View’ checkbox selected If you're viewing any webpage and you have the ‘Display all websites in Compatibility View’ checkbox selected

If you're viewing a webpage that is included on the Microsoft-supplied compatibility view updates list and you have the ‘Include updated website lists from Microsoft’ checkbox selected

If you've toggled either the ‘Document Mode’ or ‘Browser Mode’ settings via the Developer Toolbar

So you're probably after the versioning tag / HTTP header which is described in more details in that blog post and over here.

Matt Hamilton
  • 188,161
  • 60
  • 377
  • 317
  • 6
    Isn't it wonderful how Microsoft relies on personal employee blogs for documentation now days? Searching Google, all I ever got were long-winded and out-dated blog posts. – Frank Krueger Jul 14 '09 at 00:14
  • 2
    The blogs do seem to weigh highly in Google's search results. To be fair, the blog post I've quoted here was essentially one big link to a proper MSDN article, so the formal documentation does exist. – Matt Hamilton Jul 14 '09 at 00:47
6

If the "Display intranet sites in Compatibility View" or "Display all websites in Compatibility View" settings (found under Tools -> Compatibility View Settings) are enabled (as they relate to the website being viewed), then no matter what you have in the HTML of the document, the page will always be put in to some form of compatibility view.

This means that, even with in the document, you will still notice that the page is put in to compatibility view, and nothing you can do except disabling those settings will disable it, unfortunately.

Eli Sand
  • 1,022
  • 7
  • 10
  • Of course there should be some exception that still means we have to test both true/false for compatibility mode! :-( Thanks for the info – Peter V. Mørch Nov 29 '12 at 09:07
3

As per this comprehensive MSDN article on Compatibility View, the following list describes different ways that enable Compatibility View:

  • You click the Compatibility View button in the Address bar when viewing a webpage. When displayed, this button appears to the left of the Refresh button and contains an image of a broken piece of paper. This enables Compatibility View for all documents in the domain of the website being viewed.
  • The "Display all websites in Compatibility Mode setting" in the Compatibility View Settings is enabled.
  • The "Automatically recover from page layout errors with Compatibility View" setting is enabled and a webpage stops responding or crashes the browser. When this happens, Internet Explorer opens the page in Compatibility View after recovering from the problem.
  • Group policies that identify sites to be opened in Compatibility View are enabled by the administrator of your computer.
  • You have used the F12 developer tools to change the browser mode to identify Internet Explorer as an earlier version of the browser.
  • The Compatibility View List is enabled, which defines a list of websites that are automatically displayed in Compatibility View.

To avoid/disable/override Compatibility View, you'll have to do the reverse of the actions suggested above.

The Compatibility View list is an XML file maintained by Microsoft.

To remove your site from the Compatibility View List (or to dispute the removal of your site from the list), have the overall site owner verify that the domain site appears in the Compatibility View List. If it does, send an e-mail to iepo@microsoft.com that contains the following information:

Owner name Corporate title Company name Street address Email address Telephone number Website address

Microsoft will review the provided information and remove your site from the Compatibility View List at the next scheduled update.

mvark
  • 2,055
  • 2
  • 20
  • 35
1

Below link was working fine in IE and it was showing menu bar properly http://line25.com/wp-content/uploads/2012/css-menu/demo/index.html

But same content hosted on intranet, all links were displayed one below other instead of menu bar. Compatibility view button was not shown in address bar.

After below change, the menu bar got displayed correctly and compatibility view button got displayed in address bar.

Tools->Compatibility view settings->Uncheck "Display intranet sites in compatibility view"

Thanks a lot for this valuable input

1

I was having an issue with compatibility view, and it turned out some of my PHP files were being saved in UTF-8 character encoding, which I guess was confusing IE. The majority of the site files were saved in Codepage 1252.

Now, I set all the files to save as "Western European (Windows) - Codepage 1252" and my display issues went away.

The lesson here is, don't mix your character encodings.

K0D4
  • 1,877
  • 1
  • 23
  • 21