Sunday, May 13, 2007

Javascript Tip: Catch Browser Closing Event

Occasionally there is a need to catch browser closing event. The most elegant way to catch browsing closing event in IE is the following short script:

< html>
< head>
< title>< /title>
< /head>

< body onunload = "if (screenTop > 9999) alert('Closing');">

< /body>
< /html>


From which it is obvious what is usually happening to the closed windows. Enjoy :)

0 comments: