If you’ve done any web development, at all, ever, you’ve undoubtedly used–and cursed–the clunky cookie.

In all fairness, cookies are nice for what they are.  You can store basic information about users and their behaviors on the user’s machine for use on your site, and they are fairly reliable. The problem with them, though, is that they are clunky.  Clunky to set, clunky to expire, and quite limited in terms of storage capability–4000-some characters…lame.

Fortunately, in HTML5, we have a much better option for light-weight client-side storage (like cookies) without the clunky-ness, retarded size limits, and potential “leak” issues.  Actually, we have two

First, let’s talk about the Storage object to which the two options belong.  According to the proposed spec, the Storage object provides access to set, read, and remove “items” which are basically the key/value pairs that everyone is familiar with.  Unlike cookies, however, the key/value pairs do not have an expiration date associated with them, and are removed either by user action or by the cessation of a session.

Enough talk.  Let’s look at the options.

sessionStorage

sessionStorage is an attribute of the Storage object which represents a storage area for each “origin” [read domain].  In other words, sessionStorage is a place you More >