HTMLFencedFrameElement
MDN Web Docs · نسخهٔ df622a2a1c1e · CC BY-SA 2.5 و مجوز جداگانهٔ ناشر برای نمونهکد
{{APIRef("Fenced Frame API")}}
The **HTMLFencedFrameElement** interface represents a {{htmlelement("fencedframe")}} element in JavaScript and provides configuration properties.
{{InheritanceDiagram}}
Instance properties
_Inherits properties from its parent, {{domxref("HTMLElement")}}._
- {{domxref("HTMLFencedFrameElement.allow")}} {{deprecated_inline}}
- : Gets and sets the value of the corresponding
<fencedframe>allowattribute, which represents a Permissions Policy applied to the content when it is first embedded. - {{domxref("HTMLFencedFrameElement.config")}} {{deprecated_inline}}
- : a {{domxref("FencedFrameConfig")}} object, which represents the navigation of a {{htmlelement("fencedframe")}}, i.e., what content will be displayed in it. A
FencedFrameConfigis returned from a source such as the Protected Audience API. - {{domxref("HTMLFencedFrameElement.height")}} {{deprecated_inline}}
- : Gets and sets the value of the corresponding
<fencedframe>heightattribute, which specifies the height of the element. - {{domxref("HTMLFencedFrameElement.width")}} {{deprecated_inline}}
- : Gets and sets the value of the corresponding
<fencedframe>widthattribute, which specifies the width of the element.
Examples
To set what content will be shown in a <fencedframe>, a utilizing API (such as Protected Audience or Shared Storage) generates a {{domxref("FencedFrameConfig")}} object, which is then set as the value of the <fencedframe>'s config property.
The following example gets a FencedFrameConfig from a Protected Audience API's ad auction, which is then used to display the winning ad in a <fencedframe>:
const frameConfig = await navigator.runAdAuction({
// … auction configuration
resolveToConfig: true,
});
const frame = document.createElement("fencedframe");
frame.config = frameConfig;توجه: resolveToConfig: true must be passed in to the runAdAuction() call to obtain a FencedFrameConfig object. If it is not set, the resulting {{jsxref("Promise")}} will resolve to a URN that can only be used in an {{htmlelement("iframe")}}.
Specifications
{{Specifications}}
Browser compatibility
{{Compat}}
See also
- Fenced frames on privacysandbox.google.com
- The Privacy Sandbox on privacysandbox.google.com