JavaScript › Browser Storage & Web APIs
How do you check available and used storage quota in a browser?
AdvancedAnswer
Use the StorageManager API's navigator.storage.estimate(), which returns a Promise resolving to an object with usage and quota (both in bytes), covering localStorage, IndexedDB, Cache API, and other origin storage combined.
const { usage, quota } = await navigator.storage.estimate();
console.log(`Using ${usage} of ${quota} bytes`);Real-world example Warning users before an offline-capable app runs out of storage space for cached data.