Introduction
HTML5 Storage provides a standard mechanism for
local storage for key/value pairs of data, within the client web browser. The
data persists locally and remains available even after you navigate away from
the web site or close your browser too. It is widely supported in almost all
browsers in their latest versions as of date.
Differences between HTML5 Storage and Cookies
|
HTML5 Storage
|
Cookies
|
|
Local Storage on the client browser
|
Transmitted with every Http request
|
|
Stored on the client browser
|
Transmitted (unencrypted) per request
|
|
Recommendation of 5GB limit
|
4kb limit
|
HTML5 Storage uses a dictionary format - key-value
pairs of data.
Session Storage: scope is limited to the lifetime
of the browser tab. Useful for transactional or session scenario.
LocalStorage: spans multiple windows and persists
beyond the current session. Useful for performance improvements/caching
scenarios.
Methods
|
Functionality
|
Method Details
|
|
Save a value
|
sessionStorage.setItem('myKey','myValue');
OR
sessionStorage.myKey = 'myValue';
|
|
Fetch a value
|
sessionStorage.getItem('myKey');
OR
sessionStorage.myKey;
|
|
Remove a value
|
sessionStorage.removeItem('myKey');
|
|
Clear all values
|
sessionStorage.clear();
|
Storage event - This event tracks any changes to
the storage area and allows a reaction to the changes.
Errors
The Quota Exceeded Exception is raised if the
user's storage quota is exceeded. The user cannot be provided storage higher
than allowed by the browser's limits.
Potential Risks
Security and privacy concerns: Access
can only be limited to certain path within a domain. Hence, the data is
vulnerable to be accessed by unauthorized systems.

Subramanian ChellappaPosted Jun 24, 2013, 5:20 AM
Hi i am not able to identify the certain keywords are "storage.todoList" and "window.localStorage;" while writting program..
Dipal ChoksiPosted Jul 18, 2011, 7:30 PM
It's good to be 'back' :)
Dinesh BeniwalPosted Jul 13, 2011, 4:52 AM
Welcome back after a long time on article section Dipal.