HTMLIFrameElement: allow 属性
HTMLIFrameElement
接口的 allow
属性指示为该 <iframe>
元素指定的 权限策略。该策略根据请求的源,定义了 <iframe>
元素可用的功能(例如,对 microphone
、camera
、battery
、web-share
等的访问)。
allow
属性指定的权限策略是对 Permissions-Policy
头部中指定的策略的进一步限制。它并不能替代该头部。
有关更多详细信息,请参阅 <iframe>
的权限策略语法。
它反映了 <iframe>
元素的 allow
属性。
值
示例
html
<iframe
id="el"
src="https://example.com"
allow="geolocation 'self' https://a.example.com https://b.example.com; fullscreen 'none'"></iframe>
js
const el = document.getElementById("el");
console.log(el.allow); // Output: "geolocation 'self' https://a.example.com https://b.example.com; fullscreen 'none'"
有关更多可用示例,请参阅 <iframe>
元素中的权限策略。
规范
规范 |
---|
HTML # dom-iframe-allow |
浏览器兼容性
加载中…