JavaScript Document designMode Property

Beginner
5 min read
Updated: Nov 2026
3 examples
Property

Definition

document.designMode controls whether the entire document is editable. Valid values are "on" and "off" (MDN). The specification defaults to "off".

Read the notes below before you get or set this property. Prefer feature detection when support is limited.

Syntax

Use document.designMode. Start with this line.

JavaScript
document.designMode
CallWhat it does
document.designModePrimary signature.

Built into the browser. Read or assign document.designMode — no import required.

Library declarations
JavaScript
document.designMode

Parameters

ParameterDescription
ValueOptional. "on" or "off" (MDN)
Writable?Required. Getter and setter

Return Value

Return ValueDescription
*The current value of document.designMode.

JavaScript Examples

Example 1 — Read designMode

Most pages start with editing off.

JavaScript
console.log(document.designMode); // "off" (typical)
Try It Yourself

How It Works

  1. Read the property — returns a string.
  2. Expect "off" on a normal page (spec default).
  3. Valid values are only "on" and "off" (MDN).
  4. No side effects — reading does not change editability.

Example 2 — Toggle "on" / "off"

Assign the string values to enable or disable whole-document editing.

JavaScript
document.designMode = "on";
console.log(document.designMode); // "on"

document.designMode = "off";
console.log(document.designMode); // "off"
Try It Yourself

How It Works

  1. Set "on" — the whole document becomes editable.
  2. Confirm by reading the property back.
  3. Set "off" — editing stops.
  4. Careful on real pages — users can change any content; prefer iframes for demos.

Example 3 — Editable Iframe Document (MDN)

MDN pattern: enable designMode on an iframe’s document.

JavaScript
const iframe = document.querySelector("iframe");
iframe.contentDocument.designMode = "on";
console.log(iframe.contentDocument.designMode); // "on"
Try It Yourself

How It Works

  1. Get the iframe and its nested document.
  2. Set designMode on that document (MDN example).
  3. Host page stays normal — only the iframe content is editable.
  4. Classic rich-text pattern used by many older editors.

Browser Support

Document.designMode is a long-standing HTML Document property. Valid values are "on" and "off". Modern browsers follow the "off" default; older engines had quirks around "inherit" and capitalization (MDN).

✓ Widely available

Document.designMode

Controls whole-document editability. Use "on" / "off". Prefer contenteditable for scoped editors.

95% Wide support
Google Chrome Yes (off default since 43)
Yes
Microsoft Edge Yes
Yes
Mozilla Firefox Yes (spec off default)
Yes
Apple Safari Yes
Yes
Opera Yes
Yes
Internet Explorer Yes (legacy quirks)
Yes*
designMode Excellent

Bottom line: Supported across major browsers. See the MDN designMode reference.

Frequently Asked Questions

MDN: it controls whether the entire document is editable. Valid values are "on" and "off".
No. MDN does not mark Document.designMode as Deprecated, Experimental, or Non-standard. Prefer contenteditable when only one element should be editable.
MDN: the strings "on" and "off". The specification defaults to "off".
MDN: iframeNode.contentDocument.designMode = "on".
designMode edits the whole document. contenteditable makes one element or subtree editable — usually better for modern UI editors.
MDN: earlier Chrome/IE used "inherit"; IE6–10 capitalized values. Modern Chrome (43+) defaults to "off" and no longer supports "inherit".

Next: dir

Continue with the Document dir property.

dir →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

9 people found this page helpful