-
Notifications
You must be signed in to change notification settings - Fork 22.9k
FF144 Relnote+Doc: Cross origin iframe requires user interaction for top navigation #41237
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
FF144 Relnote+Doc: Cross origin iframe requires user interaction for top navigation #41237
Conversation
Preview URLs Flaws (2)Note! 1 document with no flaws that don't need to be listed. 🎉 URL:
External URLs (1)URL:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've left some questions and suggestions - let me know if any feel off the mark
Scripts running in a same-origin frame can access the {{domxref("Window.top")}} property and set {{domxref("Window.location","window.top.location")}} to redirect the top level page to a new location. | ||
This is referred to as a "top-navigation" or "framebusting". |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Scripts running in a same-origin frame can access the {{domxref("Window.top")}} property and set {{domxref("Window.location","window.top.location")}} to redirect the top level page to a new location. | |
This is referred to as a "top-navigation" or "framebusting". | |
Scripts running in a same-origin frame can access the {{domxref("Window.top")}} property and set {{domxref("Window.location","window.top.location")}} to redirect the top-level page to a new location. | |
This behavior is referred to as "top navigation". |
- Should it be "top navigation" without the hyphen?
- should we differentiate between "top navigation" and "framebusting"?
- From https://en.wikipedia.org/wiki/Framekiller it seems that framebusting is a defensive security technique where a site forces itself out of an iframe "to avoid being embedded", that is, it's a special case of top navigation?
- should we clarify that framebusting is an "attempt to force" a top navigation (and that the "intervention" is browser's behavior for preventing cross-origin framebusting)?
That is to say, AFAICT the same-origin top nav default behavior is not framebusting. Can you you check?
A cross-origin frame is only allowed to redirect the page using `top` if the frame has {{glossary("Sticky activation")}}. | ||
If a top-navigation is blocked the browser may prompt for user permission to redirect, or it may simply report the error in the developer console. | ||
What this means is that you won't be able to load a cross-origin frame and immediately redirect to a new page — the user must first (or previously) have interacted with the frame or granted permission to redirect. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be accurate to call this part "framebusting intervention"?
A cross-origin frame is only allowed to redirect the page using `top` if the frame has {{glossary("Sticky activation")}}. | |
If a top-navigation is blocked the browser may prompt for user permission to redirect, or it may simply report the error in the developer console. | |
What this means is that you won't be able to load a cross-origin frame and immediately redirect to a new page — the user must first (or previously) have interacted with the frame or granted permission to redirect. | |
A cross-origin frame is allowed to redirect the top-level page using `top` only if the frame has {{glossary("sticky activation")}}. | |
If a top navigation is blocked, browsers may either prompt for user permission to redirect or report the error in the developer console. This restriction by browsers is called framebusting intervention. | |
What this means is that you won't be able to load a cross-origin frame and immediately redirect the top-level page — the user must have previously interacted with the frame or granted permission to redirect. |
A sandboxed frame will block all top-navigations unless the values [`allow-top-navigation`](#allow-top-navigation) or [`allow-top-navigation-by-user-activation`](#allow-top-navigation-by-user-activation) are set. | ||
Note that top-navigation permissions are inherited, so a nested frame will only be allowed to perform top-navigation if its parents are able to. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- first para rephrasing is mostly stylistic
- second para edit is for changing the placement of "only", plus parents -> parent frames just to be clearer
A sandboxed frame will block all top-navigations unless the values [`allow-top-navigation`](#allow-top-navigation) or [`allow-top-navigation-by-user-activation`](#allow-top-navigation-by-user-activation) are set. | |
Note that top-navigation permissions are inherited, so a nested frame will only be allowed to perform top-navigation if its parents are able to. | |
A sandboxed frame blocks all top navigation unless the `sandbox` attribute values are set to [`allow-top-navigation`](#allow-top-navigation) or [`allow-top-navigation-by-user-activation`](#allow-top-navigation-by-user-activation). | |
Note that top-navigation permissions are inherited, so a nested frame can perform a top navigation only if its parent frames are also allowed to. |
Scripts cannot access most properties in other `window` objects if the script was loaded from a different origin, including scripts inside a frame accessing the frame's parent. | ||
Cross-origin communication can be achieved using {{domxref("Window.postMessage()")}}. | ||
|
||
### `Window.top` navigation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wondering if this title is intuitive enough. Or if we can call it something like "Top navigation in cross-origin frames" or any other phrase that devs are likely to search for to land on this section
|
||
<!-- #### DOM --> | ||
|
||
#### Media, WebRTC, and Web Audio |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this update go under HTML?
|
||
#### Media, WebRTC, and Web Audio | ||
|
||
- Framebusting Intervention: Cross-origin {{htmlelement("iframe")}}s require either user interaction or explicit permission in order to redirect the top level page using `window.top.location`, aligning behavior with Chrome and Safari. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- we don't usually include such info ", aligning behavior with Chrome and Safari"...but may be okay to keep in this case
- should we add the glossary link to sticky activation after "user interaction"
- Framebusting Intervention: Cross-origin {{htmlelement("iframe")}}s require either user interaction or explicit permission in order to redirect the top level page using `window.top.location`, aligning behavior with Chrome and Safari. | |
- Framebusting intervention is now supported, where cross-origin {{htmlelement("iframe")}}s require either user interaction or explicit permission to redirect the top-level page using `window.top.location`, aligning behavior with Chrome and Safari. |
OR
- Framebusting Intervention: Cross-origin {{htmlelement("iframe")}}s require either user interaction or explicit permission in order to redirect the top level page using `window.top.location`, aligning behavior with Chrome and Safari. | |
- Cross-origin {{htmlelement("iframe")}}s now require either user interaction (sticky activation) or explicit permission to redirect the top-level page using `window.top.location`. This restriction is called framebusting intervention. |
#### Media, WebRTC, and Web Audio | ||
|
||
- Framebusting Intervention: Cross-origin {{htmlelement("iframe")}}s require either user interaction or explicit permission in order to redirect the top level page using `window.top.location`, aligning behavior with Chrome and Safari. | ||
See [`Window.top` navigation](/en-US/docs/Web/HTML/Reference/Elements/iframe#window.top_navigation) for more information. ([Firefox bug 1419501](https://bugzil.la/1419501)). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would need to be updated if we update the section title
FF144 aligns with Chrome and Safari such that a cross origin iframe now requires sticky activation in order to redirect the top level page via
window.top.location
(in https://bugzilla.mozilla.org/show_bug.cgi?id=1419501).This PR adds a release note and also a section in the iframe docs explaining the expected behavior as it is now.
Related docs work can be tracked in #41138