HTMLIFrameElement: sandbox 屬性
HTMLIFrameElement 介面的只讀屬性 sandbox 返回一個 DOMTokenList,指示對巢狀內容的行為附加的限制。
它反映了 <iframe> 元素的 sandbox 屬性。
值
一個 DOMTokenList。每個專案必須是 <iframe> 元素的 sandbox 屬性中列出的 token 之一。
示例
html
<iframe
id="el"
title="example"
src="https://example.com"
sandbox="allow-same-origin allow-scripts"></iframe>
js
const el = document.getElementById("el");
console.log(Array.from(el.sandbox)); // Output: ["allow-same-origin", "allow-scripts"]
el.sandbox = "";
console.log(Array.from(el.sandbox)); // Output: []
規範
| 規範 |
|---|
| HTML # dom-iframe-sandbox |
瀏覽器相容性
載入中…