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 cancelled.  This could be 
> done in a way consistent with other cancellable events 

I'll reiterate what Boris has said, and I think most will
agree:

There is already an event for cancelling "leaving the page"
and that is the beforeunload event. It is widely available
and is also being standardized in HTML5:
http://www.whatwg.org/specs/web-apps/current-work/

The current event setup is quite orthogonal and nice in my 
view; you use beforeunload to know when the user is
asking to leave the page (with the option to cancel) and
the unload event to know when the user has decided to
really leave the page.

Making the unload event cancellable would be like making
the load event cancellable - wouldn't make sense.

Best regards
Mike Wilson

Received on Tuesday, 6 January 2009 16:48:30 UTC