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 5 of 5
  1. #1
    New Coder
    Join Date
    Jul 2002
    Location
    Noblesville, IN
    Posts
    94
    Thanks
    0
    Thanked 0 Times in 0 Posts

    detecting when window is closed.

    i found this explanation from another board for detecting when a window is closed (not refreshed or switching to another page, but actually closing the browser window). how would i invoke this in the popup that checks the status of the main window?

    "Open a small popup off screen to detect for self.opener.closed() if true then the end the session and close the popup."
    Ed Ventura
    Graphic/Web Designer
    www.blackwatercompany.com

  • #2
    Senior Coder A1ien51's Avatar
    Join Date
    Jun 2002
    Location
    Between DC and Baltimore In a Cave
    Posts
    2,717
    Thanks
    1
    Thanked 94 Times in 88 Posts
    problem with this is when the page is refresheded the popup looses the parent object so it will think it is closed.

  • #3
    New Coder
    Join Date
    Jul 2002
    Location
    Noblesville, IN
    Posts
    94
    Thanks
    0
    Thanked 0 Times in 0 Posts
    is this true for when a user just goes to another page also?
    Ed Ventura
    Graphic/Web Designer
    www.blackwatercompany.com

  • #4
    New Coder
    Join Date
    Jul 2002
    Location
    Noblesville, IN
    Posts
    94
    Thanks
    0
    Thanked 0 Times in 0 Posts
    actually, if you refresh, the popup get redrawn, so i think it will work ok. i just need to know how that popup checks the bottom window to see if it's closed or not. do i use a settimeout or something that runs a function that checks it?
    Ed Ventura
    Graphic/Web Designer
    www.blackwatercompany.com

  • #5
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,075
    Thanks
    0
    Thanked 256 Times in 252 Posts
    Is this for IE only?
    Code:
    function doUnload()
    {
     if ( window.event && window.event.clientX < 0 && window.event.clientY < 0)
     {
       //the browser is closed
       alert("browser closed.");
     }
    }
    ...
    <body onunload="doUnload()">
    Last edited by glenngv; 10-17-2003 at 03:53 AM.
    Glenn
    ____________________________________

    My Blog
    Tower of Hanoi Android app (FREE!)
    Tower of Hanoi Leaderboard
    Samegame Facebook App
    vBulletin Plugins
    ____________________________________


  •  

    Posting Permissions

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