Storage
Published
Storage determines how much a PWA can keep on device, how durable it is, and how it survives storage pressure. Offline-capable apps depend on it: Cache Storage holds the app shell and assets, IndexedDB holds structured data, and the StorageManager API governs quota and persistence.
These entries cover how much you get, how to make it persistent, what gets evicted, and how cross-site storage access works.
In this section
Section titled “In this section”StorageManager.persist() and persisted()How navigator.storage.persist() asks for persistent storage, what Chrome, Firefox, and Safari do with the request, and how to code for a false answer.
Clear-Site-Data response headerThe Clear-Site-Data response header: quoted directives, what cache, cookies, and storage remove, per-browser support, and how to send it on sign-out.
CacheStorage and the caches globalThe caches global: opening, listing, and deleting Cache objects, opaque-response padding against quota, and the TypeError and QuotaExceededError write failures.
Eviction and best-effort storageWhich stored data a browser may delete unasked, the LRU order Chrome and Firefox use, Safari's seven-day rule, and why a bucket is cleared whole.
IDBFactory.open() and the IndexedDB request modelHow indexedDB.open() creates and upgrades a versioned database, why schema changes belong in upgradeneeded, and the errors a PWA must handle.
localStorage and sessionStorageThe synchronous Storage interface behind localStorage and sessionStorage: syntax, the 5 MiB Firefox quota, Chromium's quota error, and the storage event.
navigator.storage.getDirectory() (OPFS)How getDirectory() opens the origin private file system, how createSyncAccessHandle() gives a worker synchronous reads and writes, and the lock errors.
Partitioned cookies (CHIPS)How the Set-Cookie Partitioned attribute gives an embedded site a cookie jar per top-level site, the Secure and __Host- rules, and engine support.
StorageManager.estimate()What navigator.storage.estimate() returns, how Chrome, Firefox, and Safari size the per-origin quota, and how to budget writes around QuotaExceededError.
Document.requestStorageAccess()How requestStorageAccess() and hasStorageAccess() give a cross-site iframe its unpartitioned cookies, the user-activation rule, and the rejections.
Home Screen web app storage isolation on iOSWhat WebKit documents about keeping a Home Screen web app's data apart from Safari, the tracking-prevention exemption it carries, and how to code for it.
← Back to the Reference overview.