HTML5 Web Storage
HTML Web Storage is a way for web pages to store named key/value pairs locally, within the client web browser. Like cookies, this data persists even after you navigate away from the web site, close your browser tab, exit your browser, or what have you. Unlike cookies, this data is never transmitted to the remote web server (unless you go out of your way to send it manually). HTML5 Storage
There are 2 types of HTML5 Web Storage, Session Storage and Local Storage. Both
of them exist as properties of window
object and can be accessed as
sessionStorage
and localStorage
. The methods of them are similar, too. The
only difference is that objects stored in session storage will be cleared when
the session expires while the ones stored in local storage are not. The
same-origin rules is applied for both of them.
To store an object in the Web Storage location, use setItem(key,value)
.