W3C home > Mailing lists > Public > whatwg@whatwg.org > October 2009

[whatwg] Navigation events generated during unload

From: Boris Zbarsky <bzbarsky@MIT.EDU>
Date: Mon, 05 Oct 2009 21:31:00 -0400
Message-ID: <4ACA9DD4.20509@mit.edu>
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
Received on Monday, 5 October 2009 18:31:00 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:59:17 UTC