IE 8's Developer Tools: Browser Mode: IE 7, IE 8, but what is IE 8 "Compatibility View"?
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 i开发者_StackOverflow中文版f 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?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)
精彩评论