It enables websites to store persistent data on users' devices similar to cookies, but with much larger capacity[1] and no information sent in HTTP headers.
Data placed in local storage is per origin—the combination of protocol, host name, and port number as defined in the same-origin policy.
Session storage is intended to allow separate instances of the same web app to run in different windows without interfering with each other, a use case that's not well supported by cookies.
[9] Web storage provides a better programmatic interface than cookies because it exposes an associative array data model where the keys and values are both strings.
Browsers that support web storage have the global objects sessionStorage and localStorage declared at the window level.