unload event handling - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


unload event handling

weirdmixweirdmix Posts: 27Member
hello all:
I'm having a problem, I'm opening an asp web page using javascript window.open method. The thing is, in the window opened I need to prevent that the user close the window without typing any information required. I mean, I know that I have to check if the user type something in fields in the UNLOAD event of the body tag, but how can I stop the window from closing if the checks are false?
I hope someone can help me.
thanks in advance.


  • WeirdofreakWeirdofreak Posts: 439Member
    The only possible way would be to use return false, but if that works there's a big problem with the browser. Imagine how easy it would be to have a page which doesn't let you leave. Besides, you can never rely on a Javascript being run. You'll need some server-side checks to see if the form is empty, instead.
    $ shameless-plug

Sign In or Register to comment.