Fence:getNestedConfigs() 方法
Deprecated
To be removed
This feature is pending removal from browsers. Using it now may lead to broken functionality in future updates.
Following the announcement that Chrome will maintain its current approach to third-party cookies, Chrome decided to withdraw certain Privacy Sandbox features including the <fencedframe> element and related APIs.
>
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];
规范
| 规范 |
|---|
| Fenced Frame> # dom-fence-getnestedconfigs> |