Fence:getNestedConfigs() 方法
Fence 接口的 getNestedConfigs() 方法会返回加载到当前 <fencedframe> 中嵌入的 <fencedframe> 里的 FencedFrameConfig 对象。
语法
js
getNestedConfigs()
参数
无。
返回值
getNestedConfigs() 有两种可能的返回值:
- 如果当前
<fencedframe>的配置是使用支持嵌套配置的 API(例如 Protected Audience)创建的,则返回一个包含 20 个FencedFrameConfig对象的数组。在这 20 个配置中,前 N 个配置是通过 API 注册的配置,其余的是填充配置,将导航到about:blank,以隐藏配置数量并防止泄露任何信息。 - 如果当前
<fencedframe>的配置是使用不支持嵌套配置的 API(例如 Shared Storage)创建的,则返回null。
示例
js
// Run inside a <fencedframe>
// Retrieve the configs of embedded fenced frames
const configs = window.fence.getNestedConfigs();
// Set a new fenced frame's config to equal one of the retrieved configs
const frame = document.createElement("fencedframe");
frame.config = configs[0];
规范
| 规范 |
|---|
| 围栏框架 # dom-fence-getnestedconfigs |
浏览器兼容性
加载中…
另见
- privacysandbox.google.com 上的Fenced frames
- 隐私沙盒(位于 privacysandbox.google.com)