Use window.onunload or windows.unload or sth like that. -----Original Message----- From: Kranti [mailto:[EMAIL PROTECTED] Sent: dinsdag 23 januari 2007 9:04 To: user@struts.apache.org Subject: BROWSER CLOSE
Hi Guys, I am working on a struts based application. I need to meet a special requirement that is when user clicks the X button on the browser the browser should not close immediately rather we should show a confirm box. if user says yes in the confirm box then only browser should close. i am trying with the following code <html><head> <script> function doUnload() { if (window.event.clientX < 0 && window.event.clientY < 0) { var answer=confirm("Window is closing..."); if (answer){ alert("Bye bye!"); return true; //window.close(); } else{ alert("Thanks for sticking around!"); return false; } } } </script> </head> <body onunload="return doUnload();"> <a href="http://www.google.com">google</a> </body></html> but no luck able to see the confirm box but the window is getting closed . Please suggest some idea Thanks Kranti This message is for the designated recipient only and may contain privileged, proprietary, or otherwise private information. If you have received it in error, please notify the sender immediately and delete the original. Any other use of the email by you is prohibited. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]