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 |
浏览器兼容性
加载中…