HTMLFencedFrameElement:config 属性
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.
>
HTMLFencedFrameElement 的 config 属性包含一个 FencedFrameConfig 对象,表示 <fencedframe> 的导航,即其中将显示什么内容。FencedFrameConfig 是从诸如受保护的受众 API 等来源返回的。
值
config 的初始值为 null。
当值设置为 FencedFrameConfig 对象实例,FencedFrameConfig 的内部属性(例如 mappedURL)将决定所关联的 <fencedframe> 内部加载的内容。此外:
- 导航类型将是
"replace"(参见NavigateEvent.navigationType),这意味着当前历史记录条目将被新条目替换,而不是为其添加一个新的历史记录条目。 - 导航的
Referrer-Policy被设置为"no-referrer"。
示例
要设置将在 <fencedframe> 中显示的内容,使用 API(如受保护的受众或共享存储)生成一个 FencedFrameConfig 对象,然后将其设置为 <fencedframe> 的 config 属性值。
以下示例从受保护的受众 API 的广告拍卖中获取一个 FencedFrameConfig,然后使用它在 <fencedframe> 中显示获胜的广告:
const frameConfig = await navigator.runAdAuction({
// 拍卖配置
resolveToConfig: true,
});
const frame = document.createElement("fencedframe");
frame.config = frameConfig;
规范
| 规范 |
|---|
| Fenced Frame> # dom-htmlfencedframeelement-config> |