HTML5 Storage

Demo

Local and Session Storage can be used to storing key/value pairs in String format. Traditionally, cookies have been used for this purpose. However storage provides larger space for persisting client size data.

Key Local Storage
Value Session Storage

Local Storage

Session Storage

Storage

Summary Local Storage

Data saved in local storage persists even after the user closes their browser. This data is stored internally using the file system and SQLite.

There is no assigned expiry time for data saved in local storage.

Session Storage

Data saved in session storage persists only as long as the user keeps their browser open. When the browser is closed, all data is lost. This data is stored internally using memory.

Data Size

The BlackBerry browser assigns 5Mb of storage space for local storage per security origin. A QUOTA_EXCEEDED_ERR exception will be raised if this limit becomes exceeded .There is no way to increase this limit.

The max size if data to be saved for each item/value pair appears to be defined by each user agent (Chrome appears to have a 47715 byte limit for either of the key or value fields).

Clearing

A web page can call the .clear() method on either the localStorage or sessionStorage object to wipe all items or the .removeItem(key) method to remove an individual item. End users can clear all storage data by clearing their cache with the "clear cookies" selection enabled.