...

View Full Version : Need help with onBeforeUnload



brandon1974
06-21-2004, 11:29 PM
Hello,

I'm having some difficulty accomplishing what I want. I want to redirect a user if they choose to close their browser window or keep them on the same page if they do not. The page in question is a frameset.

Here is the script I have so far, which is not workinng. The window will simply close.

<script>

window.onBeforeUnload = DoLogout

function DoLogout(){
if(confirm("Are you sure you want to leave?")) {
window.navigate("default.asp?logout=yes")
}
else {
window.open("admin_home.asp")
}
}


</script>

Can someone please point me in the right direction? I'd really appreciate some help!

TIA,
Brandon

Willy Duitt
06-22-2004, 02:52 AM
Why?

If I want to leave or close the browser, what business do you have trying to stop me. Besides, onBeforeUnload is IE proprietary.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum