Show session expired message

By : Coder
Source: Stackoverflow.com
Question!

I want my page to show an alert when session is expired. I have searched through stack and found MVC with JQuery: handling Session Expire

This great link explains how to retain session. But the problem is that it uses timer. In my situation it is possible that user keeps his system in sleep mode leaving the web page open. In that case the timer stops working. Pleas suggest me a way so that my code will know the session is expired even the system goes to sleep mode then wake up.

By : Coder


Answers

It is very common to store session cookies from php to the browser to set session ending information. on the server side the expire information is stored into a db. On every user request server updates cookie and database. With jquery cookie plugin you can check when the session expires. You can do it with polling(not pooling) like the others suggest on set a timer event to the time the session expires.

EDIT

I have a similar application that I'm working on. Here is what I did: in php on every ajax request i set the cookie

$exp_gmt = gmdate("D, d M Y H:i:s", time()   $this-
By : Johntor


This video can help you solving your question :)
By: admin