Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to trap the Browser Window Close

Status
Not open for further replies.
Aug 16, 2001
26
0
0
NZ
Hi !

I want to trap the event, when my browser window is getting closed (via the top right X). Based on this I'm doing a certain tasks.

regards,
rpathy.
 
You need to use Javascript for this..

The simplest way to achieve this is to put the following in the BODY tag...

onUnload="javascript: alert('Testing');"

Example:
<!-- Keep in mind that you can replace the alert function with your own javascript function -->

<BODY onUnload=&quot;javascript: alert('Testing');&quot;>


Cheers,

Gorkem.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top