Example 1 — Feature Detection
Check whether the StorageManager is available before calling it.
if (navigator.storage) {
console.log("StorageManager available");
} else {
console.log("StorageManager missing");
} How It Works
- Read the property. If missing, it is
undefined(falsy). - Gate your code. Only call
estimate/persistwhen present. - Secure context. On plain HTTP (non-localhost) the API is usually unavailable.
- No side effects. Detection does not request permissions or write data.

