Tuesday, 4 January 2011

IE8: Compatibility Views: When and How??

I was asked over the Christmas break about how Internet Explorer 8 displays documents in it's different compatibility modes. As I began to answer the question, I realized that it was not so much a question of how IE displays documents but more of a question of when, or more accurately "under what conditions"

OK, before I go to far, I need to introduce the Internet Explorer compatibility mode. Compatibility mode was introduced with IE8 as a means of displaying websites in number of different ways, depending on the website compatibility requirements.

According to Microsoft, there are three modes which include;

  • Standards mode
  • Quirks Mode
  • Compatibility mode

However, on further research I found that there are actually six modes that IE8 can use to display web-pages;

1) Emulate IE8 mode tells Internet Explorer to use the directive to determine how to render content. Standards mode directives are displayed in Internet Explorer 8 standards mode and quirks mode directives are displayed in IE5 mode. Unlike IE8 mode, Emulate IE8 mode respects the directive.

2) Emulate IE7 mode tells Internet Explorer to use the directive to determine how to render content. Standards mode directives are displayed in Internet Explorer 7 standards mode and quirks mode directives are displayed in IE5 mode. Unlike IE7 mode, Emulate IE7 mode respects the directive. For many Web sites, this is the preferred compatibility mode.

3) IE5 mode renders content as if it were displayed by Internet Explorer 7's quirks mode, which is very similar to the way content was displayed in Internet Explorer 5.

4) IE7 mode renders content as if it were displayed by Internet Explorer 7's standards mode, whether or not the page contains a directive.

5) IE8 mode provides the highest support available for industry standards, including the W3C Cascading Style Sheets Level 2.1 Specification and the W3C Selectors API, and limited support for the W3C Cascading Style Sheets Level 3 Specification (Working Draft).

6) Edge mode tells Internet Explorer to display content in the highest mode available. With Internet Explorer 8, this is equivalent to IE8 mode. If a (hypothetical) future release of Internet Explorer supported a higher compatibility mode, pages set to edge mode would appear in the highest mode supported by that version. Those same pages would still appear in IE8 mode when viewed with Internet Explorer 8.


Whoa! This is just a little complex. And, it gets worse, there are a number of conditions which might override these modes including;
  • There is no X-UA-Compatible HTTP header set by the author.
  • There is no X-UA-Compatible meta tag set by the author.
  • Microsoft has not placed the domain name of the site on a blacklist.
  • An intranet admin has not placed the site on a blacklist.
  • The user has not pressed the Compatibility View button (or otherwise added the domain to a user-specific blacklist).
  • The site is not in the intranet zone.
  • The user has not chosen to display all sites as in IE7.
  • The page is not framed by a Compatibility Mode page.
  • The (IIS) site administrator has chosen to display all pages in a specific mode
So, not quite as simple as I would like. And, as you guessed it, the person didn't like the qualified response to the question, "So, how does IE display a web page?" with the response, "It depends, ...on quite a lot.."

And, here are some references that may help you with your journey in determining how your web pages may be displayed...


Activating Browser Modes with Doctype
http://hsivonen.iki.fi/doctype/

Differences between IE8 Compatibility View and IE7
http://blogs.msdn.com/b/ie/archive/2009/03/12/site-compatibility-and-ie8.aspx

No comments: