We want to log the user out when the session ends, so one approach is to have JavaScript redirect the user to the logout script after the time period of the session passes. If the user has multiple tabs open, however, the JavaScript can activate on a tab that isn’t visible and log the user out. We can’t do an AJAX call because that would reset the session time length. What’s a good approach to dealing with logging out a user with multiple tabs open when the session ends?
EDIT: The session expires on the server after a time length. The JavaScript is just there to redirect the user to the logout page so that the content does not stay on the screen.
Expire the session cookie. Cookies can be set to expire at browser close or after a certain period of time. See http://en.wikipedia.org/wiki/HTTP_cookie#Expires_and_Max-Age