How can I warn a user they are about to navigate away from a page

  • Thread starter Thread starter Tone Curtis
  • Start date Start date
T

Tone Curtis

I have a set of webforms where I need to prompt the user to "Save Changes".
I can handle this to a degree within the form but if the user presses the
Back button or selects the Home button the data can be lost.

I have tried using javascript but that only seems to capture an event
signalling that you are leaving the page, I want something that is fired
before it navigates away. I have tried using blur events but they fire when
I switch to another window.

Has anyone out there encountered this or come up with a solution to this.

Thanks

Tone
 
not really. This of it this way, if you could you could stop somone from
EVER leaving...that wouldn't be good. You can have a dialog on the controls
in your page easy enough but not stopping the actual browser controls......
 
Tone Curtis said:
I have a set of webforms where I need to prompt the user to "Save Changes".
I can handle this to a degree within the form but if the user presses the
Back button or selects the Home button the data can be lost.

I have tried using javascript but that only seems to capture an event
signalling that you are leaving the page, I want something that is fired
before it navigates away. I have tried using blur events but they fire when
I switch to another window.

Has anyone out there encountered this or come up with a solution to this.

I'm afraid that the solution to this problem is to not use a web
application. This is not what web applications do.

What would you do if the user closed the browser? What if he turns off his
computer?
 
Back
Top