Skip to content

Fallback if localStorage is not available. #41

@gyurielf

Description

@gyurielf

Hello there!

I met a quite edge case issue while using the package.

In chrome, if you have an embed iframe on a site (which uses this package), and you open it in incognito mode it will be throws an error.
Failed to read the 'localStorage' property from 'Window': Access is denied for this document.
I walked around the issue, so it's a chrome specific issue which is exists on both mobile and desktop (tested on win, ubuntu, android),

I tried to handle on the the lacking of localStorage in a +page.ts load and throwing the user to a meaningful error page, but files are loaded by the browser when the document load starts and it's try to "connect" to the localStorage instantly and unfortunately it's kill the app before it can be handled by a svelte-kit load function.

I thought about a fallback option or something like that. I mean if it can't read the localStorage, drop a meaningful error but make a regular store regardless to prevent app breaks.

The title probably not too precise, so modify freely.

Best regards.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions