[whatwg] Navigation events generated during unload

Boris Zbarsky bzbarsky at MIT.EDU
Mon Oct 5 18:31:00 PDT 2009


On 10/5/09 9:01 PM, Ian Hickson wrote:
> Any suggestions? What do browsers actually do, white-box wise?

Gecko forbids most navigation between firing unload and the newly 
loading page becoming the current page.  "most" means all history 
navigation (including reload()) and attempts to navigate via the APIs 
exposed to the browser UI.  It allows navigation via setting 
location.href or calling location.replace _if_ the new URI is 
same-origin with the URI being loaded (the one whose loading triggered 
the unload event).  That is, you can't keep people on your site if 
they're trying to go somewhere else.

See https://bugzilla.mozilla.org/show_bug.cgi?id=409888 for the reason 
we added the same-origin exception and 
https://bugzilla.mozilla.org/show_bug.cgi?id=371360 for the reason 
there's a restriction to start with.

There is no special handling of beforeunload in this regard in Gecko.

-Boris



More information about the whatwg mailing list