Page 1 of 1

Logging out when you close the browser

Posted: Tue May 06, 2003 2:53 pm
by lloydie-t
I have recently been working with a system that you can use a browser to configure it. What interested me is that when you attempted to close the browser down a new window would open asking wether you wanted to logout og the programming session. How is that done? Be easy with me I know nothing of JS.

Posted: Tue May 13, 2003 1:31 pm
by nincha
use the event handler onUnload to open a new window or use alert().

Posted: Mon May 26, 2003 10:17 am
by lloydie-t
Nincha, belated thanks. I have managed to get it to work in a fashion, but I need to make it a little neater by also resizing the window it will open. I have tried the follwing but no joy.

Code: Select all

<html> 
<head> 
<script script language="JavaScript"> 
function LogoutSessionUser() 
&#123; window.open("http://www.touch.com/support/desk/sesslogout.php",
'toolbar=no,location=no,directories=no,status=no,menubar=no,
scrollbars=no,resizable=no,width=200,height=100')
&#125; 
</script> 
</head> 

<body onUnload=LogoutSessionUser()> 

</body> 
</html>
Can anyone help me?

Try this

Posted: Tue Jun 10, 2003 6:42 pm
by qman
Hey there. Try this in the <body>

<body onUnload="LogoutSessionUser()">

See if the quotes work for ya :wink:

a little more

Posted: Wed Jun 11, 2003 12:29 pm
by phpScott
exactly what qman said but i find that it is sometimes neccessary to put a semi colon at the end or the onUnload event like so

Code: Select all

<body onUnload="LogoutSessionUser();">
phpScott