Window: fence property

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 fence read-only property of the Window interface returns a Fence object instance for the current document context.

Fence objects are only available to documents embedded inside <fencedframe>s (loaded via FencedFrameConfigs) or <iframe>s (loaded via opaque URNs).

Note: See How do <fencedframe>s work? for some description around FencedFrameConfigs and opaque URNs.

Value

A Fence object instance, or null if the document context does not have access to a Fence object.

Examples

js
window.fence.reportEvent({
  eventType: "click",
  eventData: JSON.stringify({ clickX: "123", clickY: "456" }),
  destination: ["buyer", "seller"],
});

Specifications

Specification
Fenced Frame
# dom-window-fence

Browser compatibility

See also