Skip to content

localStorage not always available, causing TypeErrors #1444

Description

Current Behavior:

When a user loads a site with vidstack in an Android Mobile WebView, localStorage is not always available (depending on the WebView). Therefore the following error is raised:

TypeError: Cannot read properties of null (reading 'getItem')

Expected Behavior:

No error/exception is raised, localStorage is null-checked and ignored if null.

Steps To Reproduce:

Use an Android application that opens an embedded webview when opening a link.
Share a link to a page with vidstack.

Reproduction Link:
https://www.vidstack.io/player/demo?framework=react&view=player

Easiest way to reproduce:

  • In Firefox, go to about:config, disable dom.storage.enable.
  • Navigate to the demo page, it will crash.

Environment:

  • Framework: React
  • Meta Framework: Next.js
  • Node: 20.11.0
  • OS: Android 11
  • Browser: Chrome Mobile WebView 128.0.6613

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions