Compatibility with cache
Hi there, I just wanna say I love this plugin, and it’s really easy to customize it with CSS!
One problem I’ve been facing though is it doesn’t work with cache plugins. If the page is cached the page will always flash the previous colors every time I load a new page.
I’ve tried everything out there, searched the web for anything I find.
Any help would be appreciated,
Thanks!
Hi there - thanks for the feedback. Yes, I think we need to do something so that the value of the setting is read sooner so that the dark-mode setting is added to the body tag before the main page content is rendered.
Ideally the JavaScript should be higher in the DOM. For now, the only advice I have is to load the <script src="dark-mode-switch.min.js"></script> as high as possible on your page - maybe right after the switch in the top navbar.
this site also use dark mode(custom code) and does not have any problem with cache.(Of course I might be wrong) This may give you a clue to the problem https://digiato.com/ sorry,I am little slow in english best regards