Firefox Tomorrow

web api interface

HTMLFencedFrameElement

View on MDN ↗

Limited availability

The HTMLFencedFrameElement interface represents a <fencedframe> element in JavaScript and provides configuration properties.

Instance properties

Inherits properties from its parent, HTMLElement.

  • allow Experimental
    • : Gets and sets the value of the corresponding <fencedframe> allow attribute, which represents a Permissions Policy applied to the content when it is first embedded.
  • config Experimental
  • height Experimental
    • : Gets and sets the value of the corresponding <fencedframe> height attribute, which specifies the height of the element.
  • width Experimental
    • : Gets and sets the value of the corresponding <fencedframe> width attribute, 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;

[!NOTE] resolveToConfig: true must be passed in to the runAdAuction() call to obtain a FencedFrameConfig object. If it is not set, the resulting Promise will resolve to a URN that can only be used in an <iframe>.

Specifications

SpecificationsStandards references are available on the canonical MDN page.

Browser compatibility

Browser compatibilityCompatibility data is available on the canonical MDN page.

See also