Programming - - By Craig Buckler

Are You Sure You’re Testing IE8? How to Avoid Triggering Compatibility View

IE8 Compatibility ViewIn my recent post about an IE CSS bug, I noted that the issue appeared in IE8 when running on a local server but not when the file was uploaded to the internet. Fortunately, Florent V solved the mystery: IE8 was automatically switching to Compatibility View. But why does that happen?

What is Compatibility View?

Following the numerous problems encountered when upgrading from IE6 to IE7, Microsoft introduced Compatibility View in IE8. The feature switches the browser to an IE7-like rendering engine if a user encounters problems viewing a page in IE8. In theory, a page that exploited IE7’s bugs and quirks can still be displayed in the newer browser.

(Note that IE7 and IE8 Compatibility View are similar but not 100% identical … thanks, Microsoft!)

When does IE8 switch to Compatibility View?

There are several ways to switch to Compatibility View:

1. Manual switch
If the mode is not already activated, you can switch to Compatibility View by clicking the icon at the end of the address bar.

Compatibility View icon

2. All websites
In the Tools > Compatibility View Settings dialog, there is an option to display all websites in Compatibility View. This is switched off by default.

3. Microsoft website list
Microsoft compiles a list of websites where Compatibility View is required. The list is generated by the frequency of users clicking the Compatibility View icon and human verification — you can view it at res://iecompat.dll/iecompatdata.xml (IE only).

The file is distributed to all IE8 users and sites on the list are automatically displayed in the IE7-like view. The setting is normally enabled.

4. Intranet sites
By default, IE8 displays all intranet sites in Compatibility View. It’s understandable why Microsoft implemented the feature: many internal corporate web applications were developed specifically for older versions of IE several years ago.

Unfortunately, it’s this option which can trigger your latest and greatest web application work incorrectly when testing on a local server.

How does IE8 identify an intranet page?

It’s a little difficult to determine how and when IE8 identifies a page as belonging to an intranet. From my own investigation, it seems that a domain name without a period (.) is assumed to be on an intranet. Usually, non-period names are available on corporate networks with a domain server or when a domain resolution is specified in your PC’s hosts file, e.g.

mydomain 127.0.0.1

However, browsing to localhost, 127.0.0.1, or any network IP address (usually 192.168.x.x) is assumed to be an internet zone and will not trigger Compatibility Mode.

How to disable Compatibility View

When you’re testing a web application in IE8, it’s critical to know which rendering engine is being used. I’d therefore recommend disabling Compatibility View when testing sites on local PCs or servers. In IE, select Tools > Compatibility View Settings, then untick the Display intranet sites in Compatibility View box.

Compatibility View Settings

I hope that helps. Has Compatibility View ever caught you out?

Sponsors
Login or Create Account to Comment
Login Create Account