How can i do automaticaly some action when user closes tab or whole browser
to automatically log him out ?
If a regular session cookie is used (expire = "0"), the session should
expire when the whole browser is closed. Tabs are another matter,
surely depends on the browser.
An ugly method that should work: Have the browser keep the session
alive. Set a short garbage cllection time [1] for sessions on the
server (like a minute) and have the browser send in an XHR request
every 30s or so to touch the session on the server so it doesn't get
removed by the GC.
Steve
[1] in PHP this is "session.gc_maxlifetime".