I'm wondering what the best way to prevent users from accidentally closing the current window, or even navigating away from the page.
The page in question is a data entry page, and since people tend to accidentally close windows, I want to add a script to pop up a confirmation box or something to ask if the user really wants to navigate away.
I don't want the confirmation box to appear if the form is submitted though - of course.
I was thinking of doing a simple
using the onUnload event with a window.confirm() method, but the window closes BEFORE the confirmation even appears.
So is it even possible to find a solution to this?
thanks
The page in question is a data entry page, and since people tend to accidentally close windows, I want to add a script to pop up a confirmation box or something to ask if the user really wants to navigate away.
I don't want the confirmation box to appear if the form is submitted though - of course.
I was thinking of doing a simple
using the onUnload event with a window.confirm() method, but the window closes BEFORE the confirmation even appears.
So is it even possible to find a solution to this?
thanks