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: Boris Zbarsky <bzbarsky@MIT.EDU>
Date: Mon, 05 Jan 2009 09:52:44 -0500
Message-ID: <49621EBC.6070706@mit.edu>
To: "Shropshire, Andrew A" <shropshire@att.com>
CC: public-webapps@w3.org

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?

> 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?

> It may be helpful to know for WINDOW_IS_NAVIGATING_TO_NEW_PAGE events
> what the new URL is, however, this may violate security

Right.  So may just letting the script know whether the window is being 
closed, imo.

Received on Monday, 5 January 2009 14:53:30 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 18:12:50 UTC