Closed Thread Icon

Topic awaiting preservation: Need help with the onBeforeUnload event Pages that link to <a href="https://ozoneasylum.com/backlink?for=8167" title="Pages that link to Topic awaiting preservation: Need help with the onBeforeUnload event" rel="nofollow" >Topic awaiting preservation: Need help with the onBeforeUnload event\

 
Author Thread
Yossi Admon
Bipolar (III) Inmate

From: Israel
Insane since: Nov 2001

posted posted 05-14-2002 20:43

Hi.
I'm tring to hold the user in a specific page therefore I catches the onBeforeUnload BODY event.
The code I wrote is something like the following:
<script language='JavaScript'>
function BeforeUnload(){
if(confirm("Are you sure?")){
return true;
}
return false;
}
</script>

<body onBeforeUnload='return BeforeUnload();'>

When I try to move away from the page I'm in the browser popup the confirm box and then another browser confirm box.
Can I somehow cause the browser not to popup the second confirm box?
Is there is any better way to do so?

Thanks in advanced
Yossi

Yossi Admon
Bipolar (III) Inmate

From: Israel
Insane since: Nov 2001

posted posted 05-22-2002 11:18

I solved it using the following code:
<BODY onBeforeUnload="event.returnValue = 'Profile data is not saved.';">
The browser pops up a confirm box automatic and add the event.returnValue content to the confirm box.

« BackwardsOnwards »

Show Forum Drop Down Menu