Fence:getNestedConfigs() 方法

Limited availability

This feature is not Baseline because it does not work in some of the most widely-used browsers.

实验性: 这是一项实验性技术
在将其用于生产之前,请仔细检查浏览器兼容性表格

Fence 接口的 getNestedConfigs() 方法返回加载到当前 <fencedframe> 内部嵌入的 <fencedframe> 中的 FencedFrameConfig 配置。

语法

js
getNestedConfigs()

参数

无。

返回值

getNestedConfigs() 有两个可能的返回值:

  • 如果当前 <fencedframe> 的配置是通过支持嵌套配置的 API(例如受保护的受众)创建的,则为一个包含 20 个 FencedFrameConfig 对象的数组。在这 20 个配置中,前 N 个配置是通过 API 注册的,其余的是将导航到 about:blank 的填充配置,以便隐藏配置的数量并防止任何信息泄露。
  • 如果当前 <fencedframe> 的配置是通过不支持嵌套配置的 API(例如共享存储)创建的,则为 null

示例

js
// 在 <fencedframe> 内部运行

// 获取嵌入围栏框架的配置
const configs = window.fence.getNestedConfigs();

// 将新的围栏框架配置设置为与检索到的某个配置相同
const frame = document.createElement("fencedframe");
frame.config = configs[0];

规范

Specification
Fenced Frame
# dom-fence-getnestedconfigs

浏览器兼容性

Report problems with this compatibility data on GitHub
desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
getNestedConfigs
Experimental

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support
No support
No support
Experimental. Expect behavior to change in the future.

参见