files/en-us/web/api/htmlfencedframeelement/index.md
{{SeeCompatTable}}{{APIRef("Fenced Frame API")}}
The HTMLFencedFrameElement interface represents a {{htmlelement("fencedframe")}} element in JavaScript and provides configuration properties.
{{InheritanceDiagram}}
Inherits properties from its parent, {{domxref("HTMLElement")}}.
<fencedframe> allow attribute, which represents a Permissions Policy applied to the content when it is first embedded.FencedFrameConfig is returned from a source such as the Protected Audience API.<fencedframe> height attribute, which specifies the height of the element.<fencedframe> width attribute, which specifies the width of the element.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;
[!NOTE]
resolveToConfig: truemust be passed in to therunAdAuction()call to obtain aFencedFrameConfigobject. If it is not set, the resulting {{jsxref("Promise")}} will resolve to a URN that can only be used in an {{htmlelement("iframe")}}.
{{Specifications}}
{{Compat}}