[thelist] Logout

Bojan Tesanovic btesanovic at gmail.com
Tue Oct 2 05:28:27 CDT 2007


Hi Giuseppe

you can try and experiment with unload event in javascript.

Add in the body this part

<body onUnload="logOff();"> 	

then make JS function that will log off user.

So there are 3 cases that I can think of for JS function

1. Do it with AJAX call to log off user
2. Insert into HTML some image that actually logs off user by seting src 
attribute to actual server scritp eg
<img src='/users/log/off.jsp' width='0' height='0' />

3. Delete cookies that holds vars responsible for user auth



I think that #3 is easiest one as it doesn't require any call to the server, if 
your application does log in via cookies, just find name of that cookie and 
delete it in logOff() function.

Otherwise you will need to experiment with #1 and #2




Giuseppe Totaro wrote:
> Hi,
> 
> maybe this is a problem that haven't a clean solution.
> My customer ask me that web application's user log out when he close your browser (FF and MSIE 7).
> Is it possible handle this problem with JavaScript (We're using JSP)?
> 
> Giuseppe
> 



-- 
Bojan Tesanovic
http://www.classicio.com/
http://www.real-estates-sale.com/



More information about the thelist mailing list