document.compatMode Redirect 1

« DOM Reference

Summary

Indicates whether the document is rendered in Quirks mode or Strict mode.

Syntax

mode = document.compatMode 
  • mode is the string "BackCompat" for Quirks mode or "CSS1Compat" for Strict mode.

Example

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

Notes

There is a third mode, Gecko's "Almost Standards" Mode, which only differs from Strict mode in the layout of images inside table cells. This third mode is reported the same way as Strict mode: "CSS1Compat".

Specification

Document Tags and Contributors

Last updated by: Sheppy,
Hide Sidebar