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.
Last updated
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
Data stored in local storage will not be lost until the browser history is cleared or the user deletes the data. Even after restarting a browser, the data can be recovered from all windows in the same domain.
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 data for a document loaded in an incognito session is cleared when the incognito tab is closed.
Local storage continues to store data after the browser is closed and the session ends. Data storage is limited to about 5 MB.