retrieving the user input from the onbeforeunload dialog

H

haymansfield

Hi,

Im trying to capture the value the user inputs into the dialog box
brought up when the onBeforeUnload event is given an
event.ReturnValue.

If the user selects ok i dont need to do anything but if he selects
cancel (stay on the same page) I want to change the value of a
variable.

Is this possible,

Any advice would be helpful,

Cheers,

haymansfield
 
M

Mike Scirocco

Hi,
Im trying to capture the value the user inputs into the dialog box
brought up when the onBeforeUnload event is given an
event.ReturnValue.
If the user selects ok i dont need to do anything but if he selects
cancel (stay on the same page) I want to change the value of a
variable. Is this possible,
Any advice would be helpful,
Cheers,
haymansfield

This might be useful to you, I use an approach from this page:

http://forums.devarticles.com/javas...owser-from-closing-using-javascript-8458.html

function exitcheck(){
if (quit()) {
// user clicked OK
// do what you want here...
}else{
//user clicked CANCEL
// do what you want here...
}
}

function quit() {
if (confirm('Quit ?')){
return true;
}else{
return false;
}
}
window.onbeforeunload = exitcheck;
 

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,996
Messages
2,570,238
Members
46,826
Latest member
robinsontor

Latest Threads

Top