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 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Sep 2004
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    ASP Help Needed!

    Hi,

    I have written an ASP application do display information from an Access database - works fine!

    I have created a login page but now want to be able to track when a user closes the IE browser window using the X button (top right). I have managed to come up with some code to do this using the onbeforeunload value in the tag of my pages. This calls a javascript function to display a popup page called killsession.htm informing the user that the session has terminated.

    However, I don't want this popup to occur for ANY other button pressed including the Back button!

    The problem may be here:Code:
    if (event.clientY < 0)


    Could anyway suggest why my function fires every time the Back button is pressed and suggest a fix so that ONLY the X button (or Alt-F4) will call this function? There must be some final signal that can be traced just as an IE browser window is closing?

    Thanks
    -------------------------

    Code:
    Code:
    function killXSession() { 
    if (event.clientY < 0) { 
    x = screen.availWidth / 2 - 200; 
    y = screen.availHeight / 2 - 50; 
    killsessionWin = window.open("killsession.htm", "killsession", 
    "left=" + x + ",top=" + y + 
    ",height=125,width=400,fullscreen=no,toolbar=no," + 
    "status=no,menubar=no,scrollbars=no,resizable=no," + 
    "directories=no,location=no"); 
    } 
    }

  • #2
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,075
    Thanks
    0
    Thanked 256 Times in 252 Posts
    Glenn
    ____________________________________

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

  • #3
    WA
    WA is offline
    Administrator
    Join Date
    Mar 2002
    Posts
    2,596
    Thanks
    2
    Thanked 19 Times in 18 Posts
    As mentioned, please do not cross post. In the future, simply pick the most suitable category per the question. Closing thread.

    Duplicate can be found here: http://www.codingforums.com/showthread.php?t=44338
    - George
    - JavaScript Kit- JavaScript tutorials and 400+ scripts!
    - JavaScript Reference- JavaScript reference you can relate to.


  •  

    Posting Permissions

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