Partager via


Understanding the need for document compatibility modes

Each major release of Windows Internet Explorer adds features designed to make the browser easier to use, to increase security, and to support industry standards. As Internet Explorer gains features, there's a risk that older websites might not display correctly. Here we describe the primary changes in recent versions of Windows Internet Explorer so that you may understand the need for individual document compatibility modes.

If you'd prefer to keep things simple, add the HTML5 document type declaration to your webpages, so that they will be displayed in standards mode in every supported version of Internet Explorer. For more info, see Defining document compatibility.

To minimize this risk, Microsoft Internet Explorer 6 allowed web developers to choose the way Internet Explorer interpreted and displayed their webpages. Quirks mode was the default; it displayed pages as if they were viewed with older versions of the browser. Standards mode (also known as strict mode) featured the most support for industry standards; however, to take advantage of this enhanced support, webpages needed to include an appropriate <!DOCTYPE> directive.

If a site didn't include a <!DOCTYPE> directive, Internet Explorer 6 would display the site in quirks mode. If a site contained a valid <!DOCTYPE> directive that the browser didn't recognize, Internet Explorer 6 displayed the site in Internet Explorer 6 standards mode. Because few sites already included the <!DOCTYPE> directive, the compatibility mode switch was highly successful. It allowed web developers to choose the best time to migrate their sites to standards mode.

Over time, many sites began to rely on standards mode. They also began to use the features and behavior of Internet Explorer 6 to detect Internet Explorer. For example, Internet Explorer 6 didn't support the universal selector; some websites used this as a way to serve specific content to Internet Explorer.

Windows Internet Explorer 7 offered new features that were designed to more fully support industry standards, such as support for the universal selector. Because the <!DOCTYPE> directive only supports two settings (quirks mode and standards mode), IE7 Standards mode replaced Internet Explorer 6 standards mode.

As a result, sites that relied on the behavior of Internet Explorer 6 standards mode (such as lack of support for the universal selector) failed to detect the new version of the browser. This meant that content intended for Internet Explorer wasn't served to Internet Explorer 7, which in turn caused these sites to not display as intended. Because Internet Explorer 7 only supported two compatibility modes, the owners of affected sites were forced to update their sites to support IE7 mode in order for people to view them using Internet Explorer 7.

Windows Internet Explorer 8 added support for selected features from emerging standards, which are standards that haven't yet been finalized. Because the behavior of some features varied from previously published standards, it became necessary to allow web developers to choose which standards were supported by their webpages. Internet Explorer 8 introduced the concept of document compatibility, which lets you specify the version (or versions) of Internet Explorer that your site is designed to support. Document compatibility added new modes to Internet Explorer 8, such as IE8 Standards mode.

Windows Internet Explorer 9 introduced additional support for emerging standards, such as HTML5, Cascading Style Sheets, Level 3 (CSS3), Scalable Vector Graphics (SVG) 1.1 (Second Edition), and others. Because the standards are still being developed, certain behaviors had changed from earlier versions of various standards and Internet Explorer 9 supported the latest behavior specified in these standards as of the time of publication. As you might expect, these features are only available for webpages displayed in IE9 Standards mode.

Internet Explorer 10 adds support for additional standards and also updates quirks mode to correspond with changes specified in the HTML5 specification. In turn, this means that quirks mode now has access to many of the same features as standards mode. For more info, see Interoperable HTML5 Quirks mode in Internet Explorer 10.

If your site doesn't display correctly in Internet Explorer, you can either update the site to support the latest web standards (preferred) or you can force Internet Explorer to display your content as if it were being viewed in an older version of the browser. You can do this by using the meta element to add an X-UA-Compatible header to your webpages. For more info, see Specifying legacy document modes.

Defining document compatibility

Specifying legacy document modes

When to use legacy document modes

Prepare your site for web standards