How Internet Explorer Chooses Between Document Modes

By default, Windows Internet Explorer 8 uses IE8 mode, Windows Internet Explorer 9 uses IE9 mode, etc. However, Windows Internet Explorer uses several criteria to determine which document mode to use. For example, if an HTML page contains a valid <!DOCTYPE> declaration (see [HTML5]), Internet Explorer uses one of the standards-based document modes. But, if there is no valid <!DOCTYPE> declaration, Internet Explorer uses Quirks Mode. Microsoft Edge is designed to be interoperable for the web and is designed primarily to run in EdgeHTML mode. Only when there is no <!DOCTYPE> declaration does a page render in Quirks Mode.

The following rules determine how Internet Explorer selects the document mode:

1. The Developer Tools setting overrides any document mode specified by a webpage. The setting remains active for the lifetime of the tab.

2. In Internet Explorer 9, if the document is hosted in an iframe element, the document mode is determined by the document mode of the top-level webpage. Subdocuments cannot be rendered in IE9 mode unless the top-level document is also in IE9 mode.

3. A meta tag with a value of X-UA-Compatible or a HTTP response header can override items in the Compatibility View Settings list and the doctype unless the X-UA-Compatible value is a Compatibility View setting, such as IE=EmulateIE7 or IE=EmulateIE8.

4. The Compatibility View settings can force a webpage to be displayed in a less-standard document mode.

5. The Local Compatibility Site list, the Microsoft Compatibility Site list and the Enterprise Mode IE Compatibility Site list can force a webpage to be displayed in other document modes.

6. Group Policy settings override settings and force all webpages to be displayed in the specified document mode.

7. If none of these rules apply, the <!DOCTYPE> declaration determines whether the webpage renders in a standards mode, Almost Standards mode, or Quirks Mode.

The following rules determine how Microsoft Edge selects the document mode:

The <!DOCTYPE> declaration determines whether the webpage renders some specific Quirks Mode emulation (QME) behaviors called out in the [MS-HTML5] and [MS-CSS21]  documentation.

The following sections explain how these rules affect how Internet Explorer selects between document modes. Most of these sections do not apply to Microsoft Edge unless explicitly called out.