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

Boris Zbarsky wrote:
> 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?

Yes, that's the way I would go. I've also wanted to be able to 
customize the onbeforeunload dialog in some projects. 

There's some write-up here:
http://www.openajax.org/runtime/wiki/Enhanced_support_for_dialogs

Care must be taken though to ensure there is always a way to 
continue even if a custom dialog in an evil page "removes" the 
Continue option.

Best regards
Mike Wilson

Received on Monday, 5 January 2009 16:54:01 UTC