Skip to content

Location/WindowClient ancestorOrigins: note iframe referrerpolicy effect#44291

Merged
chrisdavidmills merged 2 commits into
mdn:mainfrom
vamshikrishnaramasamy:docs/issue-42231-ancestororigins-referrerpolicy
May 30, 2026
Merged

Location/WindowClient ancestorOrigins: note iframe referrerpolicy effect#44291
chrisdavidmills merged 2 commits into
mdn:mainfrom
vamshikrishnaramasamy:docs/issue-42231-ancestororigins-referrerpolicy

Conversation

@vamshikrishnaramasamy
Copy link
Copy Markdown
Contributor

Fixes #42231.

location.ancestorOrigins (and WindowClient.ancestorOrigins) don't mention that an embedding <iframe>'s referrerpolicy can keep the embedder's origin out of the list. Setting referrerpolicy="no-referrer", or referrerpolicy="same-origin" when the framed document is cross-origin, replaces the embedder's origin with an opaque origin (serialized as "null") in the framed document's ancestorOrigins.

Added a matching note to both pages that expose the property. Wording follows the behavior described by the reporter (@zcorpan) and the spec change in whatwg/html#11560.

Setting referrerpolicy="no-referrer" (or "same-origin" across an origin
boundary) on an embedding <iframe> redacts the embedder's origin from the
ancestorOrigins list of the framed document, replacing it with an opaque
origin. Document this on both pages that expose ancestorOrigins.

Closes mdn#42231
@vamshikrishnaramasamy vamshikrishnaramasamy requested a review from a team as a code owner May 29, 2026 04:16
@vamshikrishnaramasamy vamshikrishnaramasamy requested review from chrisdavidmills and removed request for a team May 29, 2026 04:16
@github-actions github-actions Bot added Content:WebAPI Web API docs size/s [PR only] 6-50 LoC changed labels May 29, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 29, 2026

Preview URLs (2 pages)

(comment last updated: 2026-05-30 02:16:53)

Copy link
Copy Markdown
Contributor

@chrisdavidmills chrisdavidmills left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, @vamshikrishnaramasamy. This looks mostly fine; my suggestions are mainly slight clarifying improvements, which aim to break up that long sentence in each case.

based on what site or list of sites is framing it.

> [!NOTE]
> The [`referrerpolicy`](/en-US/docs/Web/HTML/Reference/Elements/iframe#referrerpolicy) attribute of an embedding `<iframe>` affects this list. Setting it to `no-referrer`, or to `same-origin` when the framed document is cross-origin, redacts the origin of the document that contains the `<iframe>` from the `ancestorOrigins` list of the framed document: the origin is replaced with an opaque origin, which serializes as `"null"`.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
> The [`referrerpolicy`](/en-US/docs/Web/HTML/Reference/Elements/iframe#referrerpolicy) attribute of an embedding `<iframe>` affects this list. Setting it to `no-referrer`, or to `same-origin` when the framed document is cross-origin, redacts the origin of the document that contains the `<iframe>` from the `ancestorOrigins` list of the framed document: the origin is replaced with an opaque origin, which serializes as `"null"`.
> The [`referrerpolicy`](/en-US/docs/Web/HTML/Reference/Elements/iframe#referrerpolicy) attribute of an embedding `<iframe>` affects this list. Setting `referrerpolicy` to `no-referrer`, or to `same-origin` when the framed document is cross-origin, redacts the origin of the document containing the `<iframe>` from the `ancestorOrigins` list of the framed document. The origin is replaced with an opaque origin, which serializes as `"null"`.

The first element in the array is the origin of this window's parent, and the last element is the origin of the top-level browsing context. If this window is itself a top-level browsing context, then `ancestorOrigins` is an empty array.

> [!NOTE]
> The [`referrerpolicy`](/en-US/docs/Web/HTML/Reference/Elements/iframe#referrerpolicy) attribute of an embedding `<iframe>` affects this list. Setting it to `no-referrer`, or to `same-origin` when the framed document is cross-origin, redacts the origin of the document that contains the `<iframe>` from the `ancestorOrigins` list of the framed document: the origin is replaced with an opaque origin, which serializes as `"null"`.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
> The [`referrerpolicy`](/en-US/docs/Web/HTML/Reference/Elements/iframe#referrerpolicy) attribute of an embedding `<iframe>` affects this list. Setting it to `no-referrer`, or to `same-origin` when the framed document is cross-origin, redacts the origin of the document that contains the `<iframe>` from the `ancestorOrigins` list of the framed document: the origin is replaced with an opaque origin, which serializes as `"null"`.
> The [`referrerpolicy`](/en-US/docs/Web/HTML/Reference/Elements/iframe#referrerpolicy) attribute of an embedding `<iframe>` affects this list. Setting `referrerpolicy` to `no-referrer`, or to `same-origin` when the framed document is cross-origin, redacts the origin of the document containing the `<iframe>` from the `ancestorOrigins` list of the framed document. The origin is replaced with an opaque origin, which serializes as `"null"`.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@vamshikrishnaramasamy
Copy link
Copy Markdown
Contributor Author

Thanks @chrisdavidmills — applied both suggestions, the sentence reads much better split up. Done in be460e3.

Copy link
Copy Markdown
Contributor

@chrisdavidmills chrisdavidmills left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perfect, thanks, @vamshikrishnaramasamy!

@chrisdavidmills chrisdavidmills merged commit de2e449 into mdn:main May 30, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Content:WebAPI Web API docs size/s [PR only] 6-50 LoC changed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Document that iframe referrerpolicy can influence location.ancestorOrigins and windowclient.ancestorOrigins

3 participants