Search

3/25/2009

Activating Browser Modes with Doctype

Activating Browser Modes with Doctype


Modes for text/html Content
Quirks Mode

In the Quirks mode the browsers violate contemporary Web format specifications in order to avoid “breaking” pages authored according to practices that were prevalent in the late 1990s. Different browsers implement different quirks. In Internet Explorer 6, 7 and 8, the Quirks mode is effectively frozen IE 5.5. In other browsers, the Quirks mode is a handful of deviations from the Almost Standards mode.
If you are authoring new pages now, you are supposed to comply with the relevant specifications (CSS 2.1 in particular) and use the Standards mode.


Standards Mode

In the Standards mode the browsers try to give conforming documents the specification-wise correct treatment to the extent implemented in a particular browser.
Since different browsers are at different stages of compliance, the Standards mode isn’t a single target, either.
HTML 5 calls this mode the “no quirks mode”.


Almost Standards Mode

Firefox, Safari, Chrome, Opera (since 7.5) and IE8 also have a mode known as “the Almost Standards mode”, which implements the vertical sizing of table cells traditionally and not rigorously according to the CSS2 specification. Mac IE 5, Windows IE 6 and 7, Opera prior to 7.5 and Konqueror do not need an Almost Standards mode, because they don’t implement the vertical sizing of table cells rigorously according to the CSS2 specification in their respective Standards modes anyway. In fact, their Standards modes are closer to Mozilla’s Almost Standards mode than to Mozilla’s Standards mode.
HTML 5 calls this mode the “limited quirks mode”.


IE8 Complications
The lucky thing is that IE8 uses doctype sniffing roughly like other browsers if:

* 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.

沒有留言: