Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Jun 2004
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Need help with onBeforeUnload

    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
    Last edited by brandon1974; 06-21-2004 at 10:36 PM.

  • #2
    Banned
    Join Date
    Sep 2003
    Posts
    3,620
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Why?

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


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •