Click to See Complete Forum and Search --> : how to call function when window is closed


vinitjain
August 30th, 2002, 05:47 AM
Hi,

Does anybody knows how to call any function when window is forcefully closed. I mean how do i call a function when (x) button of browser window is clicked?

Please reply ASAP

Rgds
Vinit

jackliang
September 1st, 2002, 11:26 PM
you can write a callback function let sys to call you function when windows be destroyed.

anupam kant
September 1st, 2002, 11:54 PM
you can call function on onUnLoad event of the body.
<body onUnLoad="winUnload()">
but be aware this event also occur when you refresh or submit the winow.

try this.:)

dgobrien
September 3rd, 2002, 09:23 AM
You might also want to read up on onBeforeUnload. In the handler for this event you can warn the user and give one last chance to stop the window from closing.