how to find the closing of an application window if not' log out' the session
How to find the closing of an application window without ' log out' the session .This is to prevent the user from directly g开发者_开发百科oing to the previous session. In such cases, the user session should end and direct the user to the login page.
It's a very common problem with websites when you don't want the user to remain "logged in" although the user has left the site.
There are several ways you can achieve that, but IMHO any 100% reliable.
For example you can call an ajax function when the body onunload event
is fired, and that function could remove the current user session.
It's only an idea.
The normal/easiest way to solve this is to set Session Expiration to a rather low value (10-20 minutes).
Alternatively, you could remove a session after only 30 seconds of inactivity, and sending a little ajax request every 5 seconds (which obviously stops when the application window/tab is closed).
精彩评论