In Firefox, the JavaScript works perfectly with the top-level pages, like /index.html and /projects.html. The pages in sub-directories, for example /news/index.html and /about/team.html, get a separate setting, so when I change it to darkmode on /index.html, it gets changed on all top-level pages, but not on the sub-level(/news/index.html). It gets saved, but only separate. Is there any way to get it to work on Firefox? It would help a lot.
localStorage (and sessionStorage) store their data on a per-domain basis. For example, on my website, my localStorage items are available as long as I’m on “kleinfreund.de”. However, if I were to navigate to “www.kleinfreund.de”, I would no longer have access to the items from “kleinfreund.de” and the other way round.
In your case, it should work as long as the underlying domain is the same.
Some background: From a browser’s point of view, “kleinfreund.de” and “www.kleinfreund.de” could be entirely different websites, served by completely separate web server. That’s one of the reasons why this distinction is made.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
In Firefox, the JavaScript works perfectly with the top-level pages, like /index.html and /projects.html. The pages in sub-directories, for example /news/index.html and /about/team.html, get a separate setting, so when I change it to darkmode on /index.html, it gets changed on all top-level pages, but not on the sub-level(/news/index.html). It gets saved, but only separate. Is there any way to get it to work on Firefox? It would help a lot.
localStorage (and sessionStorage) store their data on a per-domain basis. For example, on my website, my localStorage items are available as long as I’m on “kleinfreund.de”. However, if I were to navigate to “www.kleinfreund.de”, I would no longer have access to the items from “kleinfreund.de” and the other way round.
In your case, it should work as long as the underlying domain is the same.
Some background: From a browser’s point of view, “kleinfreund.de” and “www.kleinfreund.de” could be entirely different websites, served by completely separate web server. That’s one of the reasons why this distinction is made.