Local Storage
Local storage continues to store data after the browser is closed and the session ends. Data storage is limited to about 5 MB.
Unlike the session storage data that gets cleared when the tab is closed, local storage data has no expiration time. Storage data gets cleared when the page session ends — that is, when the page is closed.
It provides a storage space that allows websites to save certain values in the browser. It is especially used for data that is intended to be stored for a long time.

Data is stored based on a named key. After that, data may be retrieved using the same key.
The following example shows the piece of code used to create a local storage object.
Local storage continues to store data after the browser is closed and the session ends. Data storage is limited to about 5 MB.
Last updated
Was this helpful?
