I have to implement auto-logout functionality in one of my projects and i just cant figure out where to start looking for ideas but SO.
What i need
This has been achieved by the following way:
1) Save the time-stamp of every request( server and ajax excluding the session check ajax request) to the server into a session var.
2) Poll the server via a JS function using ajax at frequent intervals and check if the time diff between the session time-stamp and the ajax request time is greater than the session timeout val then log-off the current user and return a bool for that ajax request.
3) Redirect the current page to the login page if the bool returned is true.