Document.designMode

概要

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> (en-US) 的文件可以給使用者編輯:

iframeNode.contentDocument.designMode = "on";

規範

Specification
HTML Standard
# dom-document-designmode-dev

瀏覽器相容性

BCD tables only load in the browser

參考