What it saves
A site can save preferences, an unfinished form, or information needed while offline. This data usually stays in the same browser on the same device unless the site syncs it through a server.
localStorage keeps small text values across visits; sessionStorage usually lasts until you close the tab. IndexedDB handles larger, more complex data, such as records for an offline app. Cookies also store data in the browser, but the browser sends matching cookies back to the website automatically, often to keep you signed in.
Do not rely on it as the only copy
People can clear browser storage, and browsers may remove it when space runs low. Someone using the same browser profile might see it. Because page code can read some stored data, sites should avoid saving sensitive details there and provide another way to save important work.