nuxt-modules / color-mode

Dark and Light mode with auto detection made easy with Nuxt 🌗
https://color-mode.nuxtjs.org
MIT License
1.08k stars 99 forks source link

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

Open irinaTescureanu opened 1 year ago

irinaTescureanu commented 1 year ago

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
manniL commented 9 months ago

Can be closed - resolved via https://github.com/nuxt-modules/color-mode/commit/e4e84fe11e1eec8946e157a4a659ed7c911fe3f1