You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Based on some initial tests in web-platform-tests/wpt#36488, in Chrome and Safari navigating or traversing to a javascript: URL does not fire beforeunload. Whereas in Firefox it does fire.
In the current spec all navigations and traversals fire beforeunload, whereas in the current state of the rewrite (#6315) only those which require a fetch will do so. So the following are the tricky cases:
It would be rather surprising if beforeunload behavior was bound to fetch. beforeunload, as the name hints, is about unloading the current page before something replaces it.
I can see that reasoning, but, (a) requiring waiting on cross-process messages for what would otherwise be very simple navigations is not great; and (b) beforeunload is generally bad, so the less of it we fire, the better IMO. If it's already not fired in 2/3 browsers in these cases, I'm inclined to spec that behavior.
This is pending some test results for the non-javascript: cases, though.
Activity
smaug---- commentedon Oct 17, 2022
It would be rather surprising if beforeunload behavior was bound to fetch. beforeunload, as the name hints, is about unloading the current page before something replaces it.
domenic commentedon Oct 17, 2022
I can see that reasoning, but, (a) requiring waiting on cross-process messages for what would otherwise be very simple navigations is not great; and (b) beforeunload is generally bad, so the less of it we fire, the better IMO. If it's already not fired in 2/3 browsers in these cases, I'm inclined to spec that behavior.
This is pending some test results for the non-javascript: cases, though.
Navigation and session history rewrite