lightzizo wrote:
Hi All,
I want to override the onbeforeunload event so that when the user
clicks on the close button, at the right top of the screen, it only
open an alert with OK button and don't close the screen
How can I do that???
You can't. onbeforeunload will allow you to ask the browser to display a
confirmation box giving the user the option to cancel the close, but the
script itself cannot prevent the window closing.
Obviously, if you could prevent a window closing then popup advert writers
everywhere would do it all the time.