Browsers & softwarePractical guides

Browser storage full? Preserve unsaved work before clearing site data

Preserve the current unsaved content first, then identify the failed write. Free disk space does not establish that a particular origin or localStorage write can succeed. Clearing site data may remove the only existing copy.

Close-up of the inside of a hard drive on a black background
Illustrative photo: Borja Verbena · Unsplash LicenseStock illustration, not a software screenshot, device review or operation record.

Key Takeaways

Record the original error and page, export content still available in memory to a location you can open, then inventory existing results before considering scoped cleanup and a small retry. navigator.storage.estimate is an estimate, not a guarantee that the next write will fit.

In this article

Protect unsaved and saved work separately

Suppose a page has three saved outputs and a fourth output has just failed to save. This is an editorial recovery scenario, not a test that fills a reader’s disk. Export the fourth output or copy text that remains available, then inventory the three saved files using the saved-result export workflow.

Open the actual downloads and check content, filenames and versions; a download notification does not establish recoverability. If unsaved content is already gone, recovery depends on retained source inputs. Freeing space does not promise to reconstruct missing content.

Identify the failed API before interpreting space

The browser quota reference distinguishes Web Storage such as localStorage from browser-managed IndexedDB, Cache and OPFS. Record the error name and triggering action. QuotaExceededError can indicate a storage constraint, but a screenshot of free disk space alone does not diagnose the failing API.

The three observations below concern different layers. A reader can report the operation and error; a developer can identify the API. Avoid bulk deletion of keys or databases whose contents have not been identified.

Three observations that are not interchangeable
ObservationWhat it can showWhat it does not establish
Free device spaceOne device conditionThat an origin write must succeed
Estimated origin usage/quotaApproximate origin storageIdentical limits for every API
Write result or errorWhether this save succeededIntegrity of every earlier result

Inspect estimates without treating them as reservations

In a site you maintain, the read-only code below can inspect estimates. It does not write files, request persistence or clear data. If the API or useful fields are unavailable, record that limitation rather than inventing an exact remaining capacity.

The estimate reference describes usage and quota as estimates. An apparently adequate difference still needs a real small write through the same API; it is neither the system’s free disk reading nor reserved space for a file.

Read-only diagnostic

if (navigator.storage?.estimate) {
  const { usage, quota } = await navigator.storage.estimate();
  console.log({ usage, quota });
} else {
  console.log("Storage estimate unavailable");
}
Run in your own test environment; values concern the current origin and browser context.

Verify saving and reopening after a scoped change

Only after exported copies open correctly should you choose a clearly scoped cleanup described by the site or maintainer. Repeat the same save operation with a small disposable input, reopen it and compare. A successful small retry does not independently verify the original larger output.

The persist reference concerns a persistence request. Its result does not establish more quota, a backup or immunity from user deletion. Another browser profile may simply have an empty result library. A bookmark export saves links, not a website database or its output files.

Further reading & sources