LocalStorage is a JavaScript object that allows storing arbitrary key-value pairs in the web browser as an alternative to cookies—another alternative if the data in question goes beyond key-value pairs is to use the IndexedDB.
localStorage
data is specific to the protocol of the document. In particular, for a site loaded over HTTP (e.g., http://example.com), localStorage
returns a different object than localStorage
for the corresponding site loaded over HTTPS (e.g., https://example.com).