HTMLFencedFrameElement
Limited availability
This feature is not Baseline because it does not work in some of the most widely-used browsers.
Experimental:This is anexperimental technology
Check theBrowser compatibility table carefully before using this in production.
TheHTMLFencedFrameElement interface represents a<fencedframe> element in JavaScript and provides configuration properties.
In this article
Instance properties
Inherits properties from its parent,HTMLElement.
HTMLFencedFrameElement.allowExperimentalGets and sets the value of the corresponding
<fencedframe>allowattribute, which represents aPermissions Policy applied to the content when it is first embedded.HTMLFencedFrameElement.configExperimentala
FencedFrameConfigobject, which represents the navigation of a<fencedframe>, i.e., what content will be displayed in it. AFencedFrameConfigis returned from a source such as theProtected Audience API.HTMLFencedFrameElement.heightExperimentalGets and sets the value of the corresponding
<fencedframe>heightattribute, which specifies the height of the element.HTMLFencedFrameElement.widthExperimentalGets 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 asProtected Audience orShared Storage) generates aFencedFrameConfig object, which is then set as the value of the<fencedframe>'sconfig property.
The following example gets aFencedFrameConfig 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;Specifications
| Specification |
|---|
| Fenced Frame> # htmlfencedframeelement> |
Browser compatibility
See also
- Fenced frames on privacysandbox.google.com
- The Privacy Sandbox on privacysandbox.google.com