In the following scenaio, how could I make use of AJAX to check if the session if is still active and then return the user to the login page?
- The user logs in and starts working
- The user disappears for 10 minutes and the session times out
- The user returns to their computer and is still on the screen they were on 10 minutes ago
- The user submits their work, buts get returned to the login screen (by my existing Session state check) and the changes are not persisted
Ideally what I'm after is some way of checking the session state every 1 minute to see if the user is idle. If they're idle and the session is about to expire, I'd save off their changes temporarily and then then, when the Session does expire, I'd automatically change the page to the login screen before the user returns from being idle.
Is it also possible to do this without using setTimeOut()?