例項屬性
繼承自其父級 HTMLElement 的屬性。
HTMLFencedFrameElement.allow實驗性-
獲取和設定相應的
<fencedframe>allow屬性的值。該屬性表示在內容首次嵌入時應用的 許可權策略。 HTMLFencedFrameElement.config實驗性-
一個
FencedFrameConfig物件,它代表<fencedframe>的導航,即將在其中顯示的內容。FencedFrameConfig可以從 Protected Audience API 等來源獲取。 HTMLFencedFrameElement.height實驗性-
獲取和設定相應的
<fencedframe>height屬性的值,該屬性指定元素的高度。 HTMLFencedFrameElement.width實驗性-
獲取和設定相應的
<fencedframe>width屬性的值,該屬性指定元素的寬度。
示例
要設定 <fencedframe> 中將顯示的內容,使用的 API(例如 Protected Audience 或 Shared Storage)會生成一個 FencedFrameConfig 物件,然後將其設定為 <fencedframe> 的 config 屬性的值。
以下示例從 Protected Audience API 的廣告競價中獲取一個 FencedFrameConfig,然後用於在 <fencedframe> 中顯示中標廣告
js
const frameConfig = await navigator.runAdAuction({
// … auction configuration
resolveToConfig: true,
});
const frame = document.createElement("fencedframe");
frame.config = frameConfig;
規範
| 規範 |
|---|
| 圍欄框架 # htmlfencedframeelement |
瀏覽器相容性
載入中…
另見
- privacysandbox.google.com 上的Fenced frames
- 隱私沙盒(位於 privacysandbox.google.com)