November 2011
Intermediate to advanced
384 pages
13h 23m
English
Retrieving data from the Web Storage API is just as easy as storing it. The only thing you need to be careful of is that the context of what you access will be retrieved as a string, so if you are expecting a number or object type, some post-retrieval conversion is required.
All Web Storage events occur relative to the user’s current domain. This means that if a user visits your website at www.mycompany.com/path/to/storage.html, anything stored there can be accessible only from other JavaScript code running within www.mycompany.com.
There are different ways to retrieve data stored in the Web Storage API:
string = localStorage.getItem(key); string = sessionStorage.getItem(key);
This will return null
Read now
Unlock full access