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

浏览器兼容性

另见