November 2011
Intermediate to advanced
384 pages
13h 23m
English
The Web Storage API is designed to store simple stringed values in two ways — long term to disk using localStorage and short term to the current browsing session using sessionStorage. You can use the Web Storage API to mirror or replace cookies as it has an inherently higher level of security and privacy features and is much easier to set and retrieve in JavaScript than cookies are.
There are several different ways to store data in the Web Storage API. The recommended way is by using the setItem() method on the intended storage interface:
localStorage.setItem(key, string); sessionStorage.setItem(key, string);
Because the storage interface emulates an associative array, the following code can be used instead, ...
Read now
Unlock full access