Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Local storage is blocked in iframes using cross domains sources. #202

Open
irinaTescureanu opened this issue Jul 13, 2023 · 3 comments
Open
Labels
bug Something isn't working

Comments

@irinaTescureanu
Copy link

irinaTescureanu commented Jul 13, 2023

When the "Block third party cookies" (default for incognito mode) is enabled in chrome, the local storage is not accessible from iframes that have a different domain source.
I think before trying to setItem or getItem, should be made a check if the localStorage is accessible at all and to have a fallback if not.

Version

@nuxtjs/color-mode: "^2.1.1",
nuxt: "^2.2.0",

Steps to reproduce

  1. put the site that uses @nuxtjs/color-mode as an iframe source in a different site, the domains should be different.
  2. open the site in an incognito window (In incognito chrome blocks third party cookies by default, in a normal chrome window you have to go to settings and check the option)

What is Expected?

I'm expecting it to not throw errors and to not block the entire app

What is actually happening?

Screenshot 2023-07-13 at 18 22 58 Screenshot 2023-07-13 at 18 24 58
@irinaTescureanu irinaTescureanu added the bug Something isn't working label Jul 13, 2023
szwenni added a commit to szwenni/color-mode that referenced this issue Jul 23, 2023
if local sotrage is not available it will fallback
atinux pushed a commit that referenced this issue Aug 8, 2023
* Fixes issue #202
if local sotrage is not available it will fallback

* fix: check all accessed values for possbile null first
@manniL
Copy link
Contributor

manniL commented Nov 25, 2023

Can be closed - resolved via e4e84fe

@damieng
Copy link

damieng commented Nov 28, 2024

Is this actually resolved? I was just trying my blog's RSS feed in Feedbro and the pages all immediately crash with "it.getColorScheme is not a function". The logs show:

Image

Am using the latest 3.5.2

@manniL
Copy link
Contributor

manniL commented Nov 28, 2024

Interesting! Needs a better fix then indeed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants