It comes as localStorage and sessionStorage, similar in behavior(and methods) but differing in their lifetimes. Key-value pairs are stored where key is a string. Values should be serialized before storing which can be done using JSON.stringify() while deserialized using JSON.parse() method. sessionStorage limits the storage till the session exists. If a site stores something in your localStorage, the data is available even when you next time visit the site.
localStorage["path"] = viracct.png; Or localStorage.path = viracct.png;
You can use other attributes of Storage object as well like- length: total key-value pairs currently in storage, key(n): name of nth key. getItem(key), setItem(key, value) and removeItem(key) can also be used for storing, retrieving and removing from storage like:
sessionStorage.setItem('blogUrl','http://viracct.blogspot.com/'); url=sessionStorage.getItem('blogUrl'); sessionStorage.removeItem('blogUrl');
null is returned when either a mentioned key does not exist while calling getItem() or removeItem(), or when n exceeds total number of pairs in key(). To empty the complete Storage use clear().
In Developer Tools under 'Storage' tab you can view all the key-value mappings stored (shown in diagram above). On left hand side click on 'Local Storage' or 'Session Storage' to see the mappings under the respective Storage. To delete a pair, select it by clicking and press the delete cross mark. You can select multiple rows at a time for deletion.
Isn't it indeed nice?