Web Storage API Methods

The APIs for both sessionStorage and localStorage are identical:


MethodDescription
getItem(key)Returns an item of data from the storage container, referenced by its key
setItem(key, item)Adds an item of data to the storage container, referenced by its key
key(index)Returns the key for an item of data at the numerical index specified
removeItem(key)Removes an item from the storage container, referenced by its key
clear()Clears out all data in the current storage container
lengthIdentifies how many items of data are in the storage container
Related Tutorial
Follow Us
https://www.facebook.com/Rookie-Nerd-638990322793530 https://twitter.com/RookieNerdTutor https://plus.google.com/b/117136517396468545840 #
Contents +