JavaScript Navigator storage Property

Beginner
⏱️ 10 min read
📚 Updated: Jul 2026
🎯 5 Examples
🚀 5 Try-it labs
Baseline
Secure context

What You’ll Learn

navigator.storage is the entry point for the Storage API’s StorageManager. Learn how to estimate usage and quota, check or request persistence, secure context rules, five examples, and try-it labs.

01

Kind

Read-only property

02

Returns

StorageManager

03

Baseline

Widely available

04

Context

Secure (HTTPS)

05

Quota

estimate()

06

Keep data?

persist()

Introduction

Modern sites store data in IndexedDB, the Cache API, and other origin storage. Browsers give each site a limited amount of space — and may clear that data when the device is low on disk unless persistence is granted.

navigator.storage returns the singleton StorageManager for the current site. MDN: you can examine and configure persistence, and learn approximately how much more space is available.

💡
Not localStorage

localStorage / sessionStorage are separate Web Storage APIs. navigator.storage is about origin storage management (quota + persistence), not a key/value map.

Understanding the storage Property

Think of navigator.storage as a storage dashboard for your origin: how much you use, how much you may use, and whether data is marked persistent.

  • StorageManager — singleton returned by the property.
  • estimate() — Promise with approximate usage and quota (bytes).
  • persisted() — Promise resolving to whether persistence is already granted.
  • persist() — request persistent storage (browser decides / may prompt).
  • getDirectory() — access the origin private file system (OPFS) when supported.
  • Secure context — HTTPS / localhost required.

📝 Syntax

General form of the property:

JavaScript
navigator.storage

Value

  • A StorageManager object for the current site / app.

Common patterns

JavaScript
// Feature-detect:
if (navigator.storage && navigator.storage.estimate) {
  // StorageManager available
}

// Approximate usage and quota:
const { usage, quota } = await navigator.storage.estimate();
console.log("Used " + usage + " of " + quota + " bytes");

// Persistence:
const already = await navigator.storage.persisted();
if (!already) {
  const granted = await navigator.storage.persist();
  console.log("persist granted?", granted);
}

⚡ Quick Reference

GoalCode
Get StorageManagernavigator.storage
Feature detectBoolean(navigator.storage)
Usage & quotaawait navigator.storage.estimate()
Already persistent?await navigator.storage.persisted()
Request persistenceawait navigator.storage.persist()
OPFS root (when supported)await navigator.storage.getDirectory()
Secure page?window.isSecureContext

🔍 At a Glance

Four facts to remember about navigator.storage.

Returns
StorageManager

Singleton

Status
Baseline

Widely available

HTTPS
required

Secure context

Key call
estimate()

usage / quota

📋 StorageManager vs Web Storage

navigator.storagelocalStorage / sessionStorage
API familyStorage API (StorageManager)Web Storage
Main jobQuota estimates & persistenceString key / value storage
Covers IndexedDB / Cache?Yes (origin storage overview)No — separate APIs
Secure contextRequiredAvailable more broadly
Best forPWAs, large offline data planningSmall preferences / tokens

Examples Gallery

Examples follow MDN navigator.storage / StorageManager patterns. Prefer Try It Yourself on HTTPS — numbers are approximate and differ by browser and origin.

📚 Getting Started

Detect the API and confirm a secure context.

Example 1 — Feature Detection

Check whether navigator.storage exists.

JavaScript
const supported = Boolean(navigator.storage);
console.log(supported ? "StorageManager available" : "StorageManager missing");
Try It Yourself

How It Works

On modern HTTPS browsers this is usually available. Still feature-detect for older engines.

Example 2 — Secure Context Check

StorageManager requires HTTPS / localhost.

JavaScript
console.log("secure: " + window.isSecureContext);
console.log("storage: " + Boolean(navigator.storage));

if (!window.isSecureContext) {
  console.log("Serve over HTTPS to use navigator.storage");
} else if (!navigator.storage) {
  console.log("Secure, but StorageManager not exposed");
} else {
  console.log("Ready to call estimate / persist");
}
Try It Yourself

How It Works

Localhost counts as a secure context for development.

📈 Practical Patterns

Estimate quota, check persistence, and request persist.

Example 3 — Estimate Usage and Quota

Ask roughly how much space this origin uses and may use.

JavaScript
async function showEstimate() {
  if (!navigator.storage || !navigator.storage.estimate) {
    return "StorageManager.estimate not supported.";
  }
  const { usage, quota } = await navigator.storage.estimate();
  const usedMB = (usage / (1024 * 1024)).toFixed(2);
  const quotaMB = (quota / (1024 * 1024)).toFixed(2);
  return "usage ≈ " + usedMB + " MB\nquota ≈ " + quotaMB + " MB";
}

showEstimate().then(console.log);
Try It Yourself

How It Works

MDN: values are approximate. Use them for UX warnings, not exact accounting.

Example 4 — Check persisted()

See whether this site already has persistent storage.

JavaScript
async function checkPersisted() {
  if (!navigator.storage || !navigator.storage.persisted) {
    return "persisted() not supported.";
  }
  const isPersisted = await navigator.storage.persisted();
  return "persisted: " + isPersisted;
}

checkPersisted().then(console.log);
Try It Yourself

How It Works

Persistent storage is less likely to be cleared under storage pressure — still not a guarantee forever.

Example 5 — Request persist()

Ask the browser to keep this origin’s storage when possible.

JavaScript
async function requestPersist() {
  if (!navigator.storage || !navigator.storage.persist) {
    return "persist() not supported.";
  }
  const granted = await navigator.storage.persist();
  return "persist granted: " + granted;
}

requestPersist().then(console.log);
Try It Yourself

How It Works

Some browsers grant automatically based on engagement; others may prompt or deny. Always check the Boolean result.

🚀 Common Use Cases

  • Offline / PWA apps — warn before filling quota; request persistence for important data.
  • Media caches — estimate space before downloading large assets.
  • Editors & notebooks — keep drafts safer with persist() when granted.
  • Storage health UI — show “X MB used of Y MB” from estimate().
  • OPFS apps — use getDirectory() when building file-like storage in the browser.

🧠 How navigator.storage Helps

1

Detect StorageManager

navigator.storage must exist in a secure context.

Detect
2

Estimate space

estimate() returns approximate usage and quota.

Quota
3

Request persistence

persist() asks the browser to keep data longer.

Persist
4

Plan offline features

Store with IndexedDB / Cache knowing your approximate limits.

📝 Notes

  • Baseline Widely available (MDN, since December 2021).
  • Not Deprecated, Experimental, or Non-standard — no status banner required.
  • Secure context required (HTTPS / localhost).
  • Returns a singleton StorageManager.
  • Related: serviceWorker, usb, locks, Window.

Universal Browser Support

navigator.storage is Baseline Widely available across modern browsers (MDN: since December 2021). It requires a secure context (HTTPS / localhost). Always feature-detect methods such as estimate and persist.

Baseline · Widely available

Navigator.storage

StorageManager entry point — estimate origin quota and request persistence for offline / PWA data.

Universal Widely available
Google Chrome StorageManager · Desktop & Mobile
Full support
Mozilla Firefox StorageManager · Desktop & Mobile
Full support
Apple Safari StorageManager · macOS & iOS
Full support
Microsoft Edge StorageManager · Chromium
Full support
Opera StorageManager · Modern versions
Full support
Internet Explorer No StorageManager support
Unavailable
storage Excellent

Bottom line: Feature-detect navigator.storage, call estimate() for UX, and use persist() when durable offline data matters.

Conclusion

navigator.storage is the Baseline entry point to StorageManager. Feature-detect it, stay on HTTPS, use estimate() for approximate quota, and persist() / persisted() when you need stronger durability for offline data.

Continue with usb, serviceWorker, or the JavaScript hub.

💡 Best Practices

✅ Do

  • Feature-detect navigator.storage and its methods
  • Serve demos over HTTPS
  • Treat estimate() numbers as approximate
  • Check persisted() before calling persist()
  • Handle false from persist() gracefully

❌ Don’t

  • Confuse this with localStorage APIs
  • Assume persistence is always granted
  • Require StorageManager for tiny preference data
  • Ignore secure-context failures on HTTP
  • Assign to navigator.storage

Key Takeaways

Knowledge Unlocked

Five things to remember about storage

Baseline StorageManager — estimate quota, request persistence, stay on HTTPS.

5
Core concepts
📊 02

Quota

estimate()

API
💾 03

Keep

persist()

Durability
🔒 04

HTTPS

required

Security
🎯 05

Not

localStorage

Clarify

❓ Frequently Asked Questions

It is a read-only Navigator property that returns the singleton StorageManager for the current site — used to estimate storage usage/quota and manage persistence of data stores.
No. MDN marks it Baseline Widely available (since December 2021). It is not Deprecated, Experimental, or Non-standard.
Yes. It is available only in secure contexts (HTTPS or localhost) in supporting browsers.
navigator.storage.estimate() returns a Promise that resolves to an object with usage and quota numbers (bytes) for your origin — approximate room left for local storage.
persisted() checks whether persistence is already granted. persist() requests that the browser keep your site’s storage when possible (may return true/false depending on browser heuristics and permission).
No. localStorage / sessionStorage are Web Storage key-value APIs. navigator.storage is the Storage API’s StorageManager for quota estimates and persistence across origin storage (IndexedDB, Cache, etc.).
Did you know?

StorageManager.getDirectory() opens the origin private file system (OPFS) — a sandboxed folder for your site. That is separate from showing a user file picker with <input type="file">.

Learn usb Next

Experimental WebUSB API — pair USB devices from the browser.

usb →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

8 people found this page helpful