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

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.

-Boris

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