Posted By

alvaroisorna on 05/13/08


Tagged

javascript session cookies


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

noah


Session variables without cookies


 / Published in: JavaScript
 

URL: http://www.thomasfrank.se/sessionvars.html

"I never liked the JavaScript implementation of cookies. The storage space is limited (4 x 20 Kb per domain), the only data format that can be used is a string and the syntax for setting and getting cookies is unnecessarily complicated. On top of that they get added to the browser request header - and since a lot of corporate firewalls only accept a rather limited request header length they might prevent your pages from loading at all. (I've seen it happen - it's ugly.) So I've made a small script that let you use JavaScript session variables without using cookies. It will let you store 2 MB of data, with much less hassle than a cookie based solution."

  1. <head>
  2. <script type="text/javascript" src="sessionvars.js"></script>
  3. ...
  4. </head>

Report this snippet  

Comments

RSS Icon Subscribe to comments
Posted By: ischenkodv on May 18, 2008

Very good script, but unfortunately session data are not restored if user opens anything in new window/tab.

You need to login to post a comment.