-
Book Overview & Buying
-
Table Of Contents
Blazor WebAssembly by Example - Third Edition
By :
The Web Storage API for JavaScript provides mechanisms for browsers to store key/value pairs of data. Browsers that support the Web Storage API provide at least 5 MB of storage per origin. The localStorage mechanism is defined in the Web Storage API for JavaScript. You must use JS interop to access the browser's localStorage because Blazor does not have access to it.
A browser's localStorage is scoped to a specific URL. Data stored in localStorage persists when the user reloads the page or closes and reopens the browser. If the user opens multiple tabs, each tab shares the same localStorage. The data in localStorage is retained until it is explicitly cleared, since it does not have an expiration date.
Data in a localStorage object that is created when using an InPrivate window or Incognito window is cleared when the last tab is closed.
These are the methods of localStorage:
key(index): This method returns the name of the key based on its position in localStorage...