Document.designMode

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.

概要

document.designMode 控制整個文件是否能夠編輯。可用的數值是 "on""off"。根據規範,這個屬性預設值為 "off"。Firefox 遵從這個標準。較早以前的 Chrome 和 IE 預設值是 "inherit"。從 Chrome 43 起,預設值是 「off」;不再支援「inherit」。在 IE6-10 中,數值為大寫英文字母。

語法

js
var mode = document.designMode;
document.designMode = "on";
document.designMode = "off";

範例

<iframe> 的文件可以給使用者編輯:

iframeNode.contentDocument.designMode = "on";

規範

Specification
HTML
# dom-document-designmode-dev

瀏覽器相容性

Report problems with this compatibility data on GitHub
desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
designMode

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support
Partial support
Partial support
Has more compatibility info.

參考