Browser troubleshooting

Request persistent storage when it is justified

Persistent storage can reduce automatic eviction risk for important offline data. Check support and request it in a user-appropriate workflow rather than assuming a grant or treating it as a backup.

Worked example

Browser console example · use a disposable page on your own site

if (navigator.storage?.persisted) {
  console.log("Persistent:", await navigator.storage.persisted());
} else {
  console.log("Persistence status is unavailable");
}
// Request only when the app has a clear reason:
// const granted = await navigator.storage.persist();

How it works

Persisted reports the current state without requesting a change. The commented request shows where an application can ask when it has a meaningful offline-storage requirement. Browser policies determine whether a request is granted and whether a prompt appears.

Limits and mistakes

Users can still clear persistent data, and a lost device or deleted profile can remove it. Keep an export or synchronization option for irreplaceable information. A grant does not make localStorage suitable for huge datasets.

Check the result

Check supported browsers and confirm the UI distinguishes a denied request from an error. Explain that important data still needs another copy outside the browser profile.

Sources

Reference documentation for the behavior used in this guide: