View Full Version : ASP Help Needed!

09-08-2004, 07:41 AM

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?



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," +

09-08-2004, 08:11 AM
Cross-posted (http://www.codingforums.com/showthread.php?p=232484#post232484)

09-08-2004, 08:25 AM
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