Cartweaver.com

 facebook Facebook
 twitter Twitter

Blog Calendar

S M T W T F S
1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30 31
<<  July  >>
2010

Blog search

Cartweaver.com ColdFusion and PHP
Shopping Carts For Adobe Dreamweaver.

Adobe Community Pro

Bookmark and Share

 

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:

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

Before posting comments or trackbacks, please read the posting policy.

Full Blog Calendar