-
Notifications
You must be signed in to change notification settings - Fork 26
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
Should we fire navigate for cross-document history.back()? #78
Comments
I agree that Can people use the beforeUnload handler and associated dialog to satisfy #32? Do we fire other events, besides |
Not currently, as beforeunload only works for cross-document navigations. We would need to invent some new kind of single-page beforeunload for the cases described there.
I think we have plenty of events in the same-document case. And in the cross-document case, yeah, the usual pagehide/beforeunload/unload events seem good to me. |
To me, it's illogical to add have a respondable event that's not cancellable - because if you can respond to a thing and defer its resolution indefinitely, you should be able to prevent it entirely. But I would defer to the security folks for what they're comfortable with, who I assume you're talking to in #32. |
In my opinion it's very different. If you respond to a back navigation, the back navigation still goes through: you just change the contents of the page that is displayed, i.e. you make it a single-page navigation. Whereas, canceling it stops the back navigation, and leaves you in the current place in the history stack. |
I mean from an abuse perspective. If I use respondWith and just leave the promise unresolved, that's a weird user UI too - because it looks like the page is forever loading. But I suppose you're right, if they click back again they're not trapped |
(All of this applies to forward as well as back, but I'll only mention back for simplicity.)
The current table has slightly divergent entries for
history.back()
vs. browser-UI-initiated back navigations. Summarizing:Since this design, a couple of data points have come up:
@natechapin reports that distinguishing
history.back()
from browser back is currently hard in Chrome, so it'd be kind of nice if we didn't have to.As part of the discussions in Probably don't allow interception of navigations from other documents #75, we realized that
history.back()
might originate from another frame, and letting that be canceled could be weird. Although it doesn't have the security difficulty discussed there of exposing the navigated-to URL, it might be good to treat the situations similarly.These might lean toward something more conservative like making
history.back()
behave the same as browser back: never cancelable, and no event at all when it's cross-document:However, #32's use case of allowing pages to show "are you sure you want to leave?", and in particular some of the latest ideas in #32 (comment), tugs us in a different direction, even if we did want to unify: something like
And at that point tying
history.back()
to user activation seems pretty strange, so I'd suggestand none of the above ideas even start taking into account the initiator, per #75.
So: I'm considering this blocked on #32 and #75 for now.
The text was updated successfully, but these errors were encountered: