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: Shropshire, Andrew A <shropshire@att.com>
Date: Mon, 5 Jan 2009 13:58:16 -0500
Message-ID: <24D5F2204CBFC84499520C14CC11036C0823ABC0@vna-exch1.gsi.grci.com>
To: "Mike Wilson" <mikewse@hotmail.com>, "Boris Zbarsky" <bzbarsky@MIT.EDU>
Cc: <public-webapps@w3.org>

Thanks everyone for addressing this issue.  The wiki page does help
underscore the need for something like onbeforeunload in the standard.

Whether onbeforeunload is fixed or whether to change unonload seems not
too important since the functionality offered by either approach is
identical.  Having a separate onbeforeunload seemed to me to
unnecessarily complicate matters.
I am working a dialog problem now and I have discovered another problem
with Onbeforeunload:

It is called even for javascript URLs which clearly aren't exiting the
page.  Ie.  It gets called when user clicks on <a

This is very annoying, as I must change this to
<span style="cursor:pointer;text-decoration:underline"
To avoid this.


-----Original Message-----
From: Mike Wilson [mailto:mikewse@hotmail.com] 
Sent: Monday, January 05, 2009 11:53 AM
To: 'Boris Zbarsky'; Shropshire, Andrew A
Cc: public-webapps@w3.org
Subject: 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:

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 18:59:21 UTC

This archive was generated by hypermail 2.3.1 : Friday, 27 October 2017 07:26:13 UTC