A blog for web developers about all things ecommerce.: Dang! My session timed out!
Dang! My session timed out!
Thursday, February 04, 2010 12:00:00 AM
A Heartbeat script may be the end of your session time-out frustrations.
We have all been there. Updating a web form and after working on it for quite a while the phone rings or somebody need our attention. You go back to you web form and finish it, then submit it only to find that your log in session has expired and you lose all your work!!! (insert explicative here).
"I can hear your heartbeat"
There is a way around this with AJAX / jQuery. There are several variations available of what has become to be known as a "Heartbeat" script. The purpose of this script is to Asynchronously ping or poll the server at given intervals to keep your session on the server alive. Here are a few exasmples:
- http://www.jasons-toolbox.com/JHeartbeat/
- http://www.ajtrichards.co.uk/jquery-hearbeat/
- http://www.ajaxpatterns.org/Heartbeat
There are numerous others that you can find by doing a quick Google search on "Heartbeat jQuery Script"
Some of the scripts you will find use the jQuery framework, others do not, but all follow the same idea and that is to simply interact occasionally with the server in the background to let the server know you are still there. This can save a lot of frustration for our clients and ourselves - c'mon admit it... Even though you constantly tell your clients to remember to update frequently to save their work you forget from time to time and get caught by this as well!
The cure-all?
Is this little script the cure-all that we have been looking for? Quite possibly, but as with any JavaScript function you'll need to test it with your application to be certain it doesn't conflict with anything else you have going on. It's pretty easy to implement, and worth the time however, so you might want to give it a try.
Category tags: General Topics, True Life Stories
Posted by Lawrence Cramer
Add comment
|
View comments (0) |
Permalink
|
Trackbacks (0)
|
Digg This
Before posting comments or trackbacks, please read the posting policy.
Blog RSS feed