Home > widget-integration > FilterStorageHelper > isLocalStorageAvailable

FilterStorageHelper.isLocalStorageAvailable() method

Checks if localStorage is available and accessible.

Tests localStorage availability by attempting to write and remove a test value. Returns false in SSR contexts, private browsing mode, or when storage is disabled.

Signature:

isLocalStorageAvailable(): boolean;

Returns:

boolean

True if localStorage is accessible and writable

Remarks

Use this before critical storage operations that must succeed. Note that availability can change during runtime (user disables storage).

Example

Override to add custom storage detection:

isLocalStorageAvailable() {
  const available = super.isLocalStorageAvailable();
  if (available) {
    // Check custom storage quota requirements
    return this.hasEnoughStorageQuota();
  }
  return false;
}