Answer
Browsers persist data per origin with very different semantics:
| API | Capacity | Persistence | Sync |
|---|---|---|---|
| localStorage | ~5 MB (varies) | Until cleared | Synchronous, main thread |
| sessionStorage | Same tab session | Tab lifetime | Synchronous |
| IndexedDB | Large (often 50%+ disk) | Until evicted | Async |
| Cache API | Part of origin quota | SW-managed | Async |
Eviction: under storage pressure browsers use LRU heuristics — origins without recent user interaction may be cleared first. Safari ITP is aggressive with third-party and cross-site storage.
Best practice: use IndexedDB (via Dexie/idb) for structured/large data; never block main thread with sync storage.