Local Storage

Local Storage in html5

Thanks to local storage (not officially HTML5, but grouped in for convenience’s sake), we can make advanced browsers “remember” what we type, even after the browser is closed or is refreshed.

localStorage sets fields on the domain. Even when you close the browser, reopen it, and go back to the site, it remembers all fields in localStorage.


localStorage and sessionStorage

There are two storage options:

  1. sessionStorage sets fields on the window. When the window is closed, the session fields are lost, even if the site remains open in another window.
  2. localStorage sets fields on the domain. Even when you close the browser, reopen it, and go back to the site, it remembers all fields in localStorage.

Essentially, that means that the entire sessionStorage is cleared when the user closes the browser window, while localStorage will remain available forever.
Local Storage Local Storage Reviewed by Bhaumik Patel on 7:31 AM Rating: 5