...

View Full Version : Can I stop the browser from being closed?



cclark01
06-08-2004, 03:40 PM
Our project stakeholders have asked that we add in a "Are you sure you want to quit?" prompt when/if the user clicks on the close ("X") icon in the upper-right corner. They'll also want this on an Alt-F4 or system menu "Close".

I tried to invoke a javascript from the <body onunload=""> with a call to window.confirm, and it did get called, but too late. The browser was long gone by the time I had clicked on the button in the confirmation window.

I suspect that this is impossible, but I'm hoping that somebody might have figured out a way to do this. Any suggestions, tips, scripts, etc (or even a defniitive "no") will be appreciated.

liorean
06-08-2004, 05:18 PM
Try using onbeforeunload, that should work in the browsers that support it.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum