views:

49

answers:

1

In IE 8, we can bring out the Developer Tools. Then on top, there is a Browser Mode:

IE 7
IE 8
IE 8 Compatibility View

So if IE 7 is to force the page to be shown as if the browser is IE 7, and
IE 8 is to force the page to be shown using the standard IE 8 as it is,
then what is the extra IE 8 "Compatibility View" for? What use is it? If we already have IE 7, why need this extra mode? What does this mode do that the IE 7 mode cannot do?

+1  A: 

The difference is in the user agent string.

"IE7" emulates IE7's user agent string exactly, showing MSIE 7.0. "IE8" uses IE8's native user agent string exactly, showing MSIE 8.0 as well as Trident/4.0, which is the version of the Trident layout engine used in IE8.

IE8-Compatibility uses the browser's native user agent string, but changes "8.0" to "7.0".

Because Trident did not have a version number prior to IE7, the IE7 string does not show "Trident/x.x". So with an MSIE 7.0 user agent string, if "Trident/4.0" is also present, you know it's IE8 running in compatibility view; if "Trident/x.x" is NOT there, you know it's either the real IE7 or IE8 in IE7 mode (not compatibility mode).

I hope my explanation is clear enough, and here is an example of some user agent strings below.

IE7:

Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; FDM; MS-RTC EA 2; Tablet PC 2.0; .NET4.0C; .NET4.0E)

IE8:

Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; FDM; MS-RTC EA 2; Tablet PC 2.0; .NET4.0C; .NET4.0E)

IE8-Compatibility:

Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; FDM; MS-RTC EA 2; Tablet PC 2.0; .NET4.0C; .NET4.0E)

Jake Petroules
What is the use of IE 8 Compatibility View then? Just to have a different USER_AGENT string? Also, when the website provide pages to user with the meta tag with IE7-Compatibility, then isn't the situation reversed? (browser saying it is IE 8, but page is rendered at client using the non-Trident rendering engine) -- so again, what is the use of choosing "IE 8 Compatibility View" in the Developer Tools?
動靜能量
Websites might differentiate between IE7 and IE8-in-compatibility-mode based on the user agent string. The different modes will allow you to see any differences the website may have when it is sent either of the two strings.
Jake Petroules