keyboard_backspace wifi_off

Storage API

This feature is not (yet) supported on your device

The Storage API enables web apps to store structured data in IndexedDB, Cache Storage, LocalStorage, and SessionStorage. The available and used storage space can be obtained through await navigator.storage.estimate() which returns a Promise that resolves to the quota and usage properties that return the available and used storage space respectively.

In Chrome and Edge, an additional property usageDetails is returned that specifies the used space by storage type which may vary per browser.

Storage usage
Available storage
Used storage

Persistent storage

Web apps can request persistent storage which means that any data stored in IndexedDB and Cache Storage will no longer be deleted by the browser when for example storage space runs low or the user hasn't interacted with the app for a period of time.

The browser will retain the data as long as possible and in case it becomes necessary to remove data when storage space runs low, the browser will notify the user and provide a way to remove some data manually.

In supporting browsers, web apps can request persistent storage through navigator.storage.persist(). Permission is granted by the browser based on how much the user has interacted with the app and if the app is installed as a PWA. To check if an app already has persistent storage, use await navigator.storage.persisted() which returns a Promise that resolves to true or false.

If persistent storage is not granted, try interacting with the app more or install it as a PWA.

check_circleThis app has persistent storage!
// check if Storage API is supported const supported = 'storage' in navigator; // check if persistent storage is supported const persistentStorageSupported = navigator.storage && navigator.storage.persist; // request persistent storage const persist = await navigator.storage.persist(); // check if app already has persistent storage const hasPersistentStorage = await navigator.storage.persisted(); // get usage statistics const {quota, usage, usageDetails} = await navigator.storage.estimate();

Documentation

Storage API on MDN

Browser support

Storage API persist on caniuse.com

Storage API estimate on caniuse.com

What PWA Can Do Today A showcase of what is possible with Progressive Web Apps today