Document.compatMode

The Document.compatMode read-only property indicates whether the document is rendered in Quirks mode or Standards mode.

Syntax

const mode = document.compatMode

Value

An enumerated value that can be:

  • "BackCompat" if the document is in quirks mode.
  • "CSS1Compat" if the document is in no-quirks (also known as "standards") mode or limited-quirks (also known as "almost standards") mode.

Note: All these modes are now standardized, so the older "standards" and "almost standards" names are nonsensical and no longer used in standards.

Example

if (document.compatMode == "BackCompat") {
  // in Quirks mode
}

Specifications

Specification Status Comment
DOM
The definition of 'compatMode' in that specification.
Living Standard

Browser compatibility

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
compatMode
Non-standard
Chrome Full support 1Edge Full support 12Firefox Full support 1IE Full support 6Opera Full support ≤12.1Safari Full support 3.1WebView Android Full support 1Chrome Android Full support 18Firefox Android Full support 4Opera Android Full support ≤12.1Safari iOS Full support 2Samsung Internet Android Full support 1.0

Legend

Full support  
Full support
Non-standard. Expect poor cross-browser support.
Non-standard. Expect poor cross-browser support.