SearchSearch   

retrieving the user input from the onbeforeunload dialog

 
   Webmaster Forums (Home) -> Javascript RSS
Next:  two script pages  
Author Message
haymansfield

External


Since: Aug 09, 2007
Posts: 1



(Msg. 1) Posted: Thu Aug 09, 2007 4:14 pm
Post subject: retrieving the user input from the onbeforeunload dialog
Archived from groups: comp>lang>javascript (more info?)

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
Back to top
Mike Scirocco

External


Since: Apr 06, 2006
Posts: 18



(Msg. 2) Posted: Wed Sep 19, 2007 7:34 pm
Post subject: Re: retrieving the user input from the onbeforeunload dialog
Archived from groups: per prev. post (more info?)

haymansfield DeleteThis @googlemail.com wrote:
> 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/javascript-development-22/how-to-stop-br...er-from

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;
Back to top
Display posts from previous:   
       Webmaster Forums (Home) -> Javascript
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum