Embeds content in a frame that strictly isolates it from its embedder for privacy.
The <fencedframe> element embeds another browsing context, similar to <iframe>, but with strong privacy isolation. Content loaded inside a fenced frame cannot share storage, cookies, or messaging with its embedder, which makes it suitable for showing third-party content (such as ads selected via the Privacy Sandbox APIs) without leaking cross-site identifiers.
Fenced frames intentionally restrict many of the capabilities iframes have: their src is set indirectly via a FencedFrameConfig object, they cannot be reached by scripts in the parent page, and certain APIs (geolocation, navigator.userAgent details, focus tracking) are limited or stubbed. This makes them a key building block for privacy-preserving advertising and content delivery on the web.
Fenced frames are part of an evolving privacy proposal and are still gated behind flags or origin trials in browsers that ship them. Their final shape may change as the Privacy Sandbox specifications mature, so production use should monitor caniuse and the relevant explainers carefully.
| Name | Description | Optional |
|---|---|---|
config |
A FencedFrameConfig describing the content to embed; assigned via JavaScript. | Yes |
<fencedframe id="ad" width="300" height="250"></fencedframe>
<script>
// config produced by Privacy Sandbox APIs
document.getElementById('ad').config = adConfig;
</script>