View Full Version : control in closing window

07-11-2005, 05:50 PM
How can I put an alert when the user is trying to close the window?
I tried with onUnload, but the window is closed before the function associated is called.
Any idea?

07-11-2005, 06:25 PM
<body onunload="alert('You are closing this window');">

The onunload event is often disabled by various browsing softwares/plugins such as popup blockers due to abuse over the years. I would suggest using a different strategy to do whatever it is you are trying. As a general rule if there's onunload popups on a website, I do not return ;)