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

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
 
C

Curt_C [MVP]

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......
 
J

John Saunders

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?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,576
Members
45,054
Latest member
LucyCarper

Latest Threads

Top