You are here: Reference > JavaScript > client-side > HTML DOM > properties > compatMode (document)

compatMode property (document)

Browser support:
Returns whether rendering works in Quirks or Strict mode.
The rendering mode of a document depends on the doctype declaration and the currently used browser. If rendering works in Strict mode, then the document is rendered according to the W3C standards. This rendering mode can cause problems in older browsers. If the document is rendered in Quirks mode, then the behavior of older browsers is emulated. To get detailed description about the Quirks and Strict modes, visit this page: Quirks mode (Wikipedia)


You can find the related objects in the Supported by objects section below.
This property is read-only.

Possible values:

String that represents the rendering mode.
One of the following values:
Document is rendered in Quirks mode.
Document is rendered in Strict mode.
Default: this property has no default value.

Example HTML code 1:

This example illustrates the use of the compatMode property:
    <script type="text/javascript">
        function GetRenderingMode () {
            var compMode = (document.compatMode == "BackCompat")? "Quirks" : "Strict";
            alert ("The document is rendered in " + compMode + " mode.");
    <button onclick="GetRenderingMode ();">Get rendering mode</button>
Did you find this example helpful? yes no

Supported by objects:

Related pages:

External links:

User Contributed Comments

Post Content

Post Content