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 <BODY> 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: Select all
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: Select all
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");
}
}
