One note on TJ's post, hopefully helpful:

You cannot CANCEL the unload event. If i understand them correctly,
load and unload are the only native events that can't be canceled from
scripts. You can perform other actions, but unload means the browser
has been committed to unloading that page, regardless what else it's
told to do at that point. The point of no return to let the user
cancel the unload is "beforeunload" (handy, and a Microsoft creation,

And to his point, he's correct: about the only other actions you can
take are cleanup/garbage collection. Not that it would matter anyway
if you create new content, the page is going bye-bye. :)

That all comes from a painful two weeks a few years ago before i knew
about beforeunload. Still bitter at myself over that.
-joe t.

On Mar 10, 9:31 am, Walter Lee Davis <> wrote:
> On Mar 10, 2011, at 2:25 AM, T.J. Crowder wrote:
> > What you can do in those functions is severely limited by modern
> > browsers (for all the good reasons you can think of). You can't open
> > new windows, do alerts/confirms
> Thanks. This is the part I was remembering -- someone wanted an Are  
> You Sure to interrupt closing the window on a running process, and I  
> mistook the answer to mean that onunload couldn't do much of anything,  
> versus 'couldn't do much of anything to the current window'. That  
> makes perfect sense now.
> Walter

You received this message because you are subscribed to the Google Groups 
"Prototype &" group.
To post to this group, send email to
To unsubscribe from this group, send email to
For more options, visit this group at

Reply via email to