W3C home > Mailing lists > Public > public-webapps@w3.org > January to March 2009

Re: Proposal: Detecting when the user leaves a page due to hitting the back button or typing in a URL or going to a favorite

From: Giovanni Campagna <scampa.giovanni@gmail.com>
Date: Mon, 5 Jan 2009 17:17:49 +0100
Message-ID: <65307430901050817t13e343f2i5b1b3ce920bb780b@mail.gmail.com>
To: public-webapps@w3.org
2009/1/5 Boris Zbarsky <bzbarsky@mit.edu>

>
> Shropshire, Andrew A wrote:
>
>> 1. Allow the unload event to be cancellable from script.  This will
>> allow web designers to recreate the modal flavor of desktop apps like MS
>> Excel that prompt with "Yes/No Cancel" when there are unsaved changes.
>>
>
> Doesn't the onbeforeunload event do this?  Or is your issue wanting to
> change the text and/or provide that one extra option (instead of the two
> dialogs one would need right now to give all three of Yes/No/Cancel as
> options)?  If so, would it make sense to extend onbeforeunload to do what
> you want instead of changing unload?
>

Probably treating the onbeforeunload as a real cancelable event (like
domactivate or rightclick) instead of callback that should provide some text
may be what he meant (the rest is matter of naming, ie. onunload vs
onbeforeunload)

>
>  2. In the unload event, distinguish between closes and navigating away,
>> by adding a property to the event object such as getUnloadType() which
>> returns an enumerated type with one of these values:
>>
>
> I'm not sure the script needs this information, to be honest.  What are the
> use cases?
>

One may attach a onbeforeunload to a frame, and would like to know if only
its javascript context is going to
disappear, instead of the whole tab being destroyed, so it can send messages
to parent window and have them read and handled

Giovanni
Received on Monday, 5 January 2009 16:18:24 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 18:49:29 GMT