Back to Content

Window: fence property

files/en-us/web/api/window/fence/index.md

latest1.2 KB
Original Source

{{SeeCompatTable}}{{APIRef("Fenced Frame API")}}

The fence read-only property of the {{domxref("Window")}} interface returns a {{domxref("Fence")}} object instance for the current document context.

Fence objects are only available to documents embedded inside {{htmlelement("fencedframe")}}s (loaded via {{domxref("FencedFrameConfig")}}s) or {{htmlelement("iframe")}}s (loaded via opaque URNs).

[!NOTE] See How do <fencedframe>s work? for some description around FencedFrameConfigs and opaque URNs.

Value

A {{domxref("Fence")}} object instance, or null if the document context does not have access to a {{domxref("Fence")}} object.

Examples

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

Specifications

{{Specifications}}

Browser compatibility

{{Compat}}

See also