faqts : Computers : Programming : Languages : JavaScript : Windows

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

63 of 83 people (76%) answered Yes
Recently 6 of 10 people (60%) answered Yes

Entry

Why does it seem that ONUNLOAD doesn't fire with NN when the window is closed??

Mar 6th, 2000 08:04
Martin Honnen, Jap Boon Churn,


People use
  <BODY ONUNLOAD="alert('unload')">
to check whether the unload event fires/the onunload handler works. 
That way it seems with NN that the event doesn't fire when you close 
the window as the alert doesn't appear. It is however the case that the 
alert dialog is swallowed by the closing window ALTHOUGH the unload 
event fires. For instance try
  <BODY ONUNLOAD="java.lang.System.out.println(event.type)">
and then close the window and check the java console and you will find 
the output of the onunload handler.
So don't expect alert/confirm/prompt dialogs to show up when called from
  <BODY ONUNLOAD
with NN but otherwise your onunload handler will probably work 
reliably.