W3C home > Mailing lists > Public > whatwg@whatwg.org > December 2012

Re: [whatwg] events when navigating away before page load?

From: Ian Hickson <ian@hixie.ch>
Date: Fri, 14 Dec 2012 20:10:44 +0000 (UTC)
To: Mike Wilson <mikewse@hotmail.com>
Message-ID: <Pine.LNX.4.64.1212142008000.12469@ps20323.dreamhostps.com>
Cc: whatwg@whatwg.org
On Fri, 14 Dec 2012, Mike Wilson wrote:
> Anyway, the finding that originally got me started on looking at this 
> was that I received an unload event without a preceeding load event. 
> Naively this seems logically wrong, but I appreciate these are 
> complicated matters so I'm content with the answer that this probably 
> shouldn't be expected in these kinds of cases.

Yeah, this whole area is rather gnarly.

As a general rule, the intent of the spec is that you get a "load" when 
all your scripts (and other resources) have loaded, and you get an 
"unload" when the page is going away. Thus if the page goes away before 
the page has finished loading, you just get an "unload".

We additionally also suggest firing a "load" and so forth when the user 
aborts the page, on the assumption that you probably have all the scripts 
you need and are only missing minor things like ads or analytics, but that 
doesn't apply when the page is aborted because another page is going to 
replace it.

Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'
Received on Friday, 14 December 2012 20:11:10 UTC

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