HTMLFencedFrameElement
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.
>
Experimental: This is an experimental technology
Check the Browser compatibility table carefully before using this in production.
The HTMLFencedFrameElement interface represents a <fencedframe> element in JavaScript and provides configuration properties.
Instance properties
Inherits properties from its parent, HTMLElement.
HTMLFencedFrameElement.allow-
Gets and sets the value of the corresponding
<fencedframe>allowattribute, which represents a Permissions Policy applied to the content when it is first embedded. HTMLFencedFrameElement.config-
a
FencedFrameConfigobject, which represents the navigation of a<fencedframe>, i.e., what content will be displayed in it. AFencedFrameConfigis returned from a source such as the Protected Audience API. HTMLFencedFrameElement.height-
Gets and sets the value of the corresponding
<fencedframe>heightattribute, which specifies the height of the element. HTMLFencedFrameElement.width-
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 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;
Specifications
| Specification |
|---|
| Fenced Frame> # htmlfencedframeelement> |
Browser compatibility
See also
- Fenced frames on privacysandbox.google.com
- The Privacy Sandbox on privacysandbox.google.com