Search code examples
javascripthtmlfilecookieslocal-storage

How do i store data for HTML for file://


so I wanted to store a cookie for light mode and dark mode inside a html file in file://, NOT a webpage. file:// path, not a webpage

but then I learnt that cookies don't actually work on file:// (or at least on chrome). so I googled and learnt about local storage, but that too does not work....

so I wanted to know is there any other way of storing data even on a file:// path?

thank you

UPDATE: I have found out a way to do this, instead of using things like Cookies, Local Storage, etc. We could use "Indexed DB". Personally, this worked for me and i am pretty sure almost or even all browsers have compatibility for it. This is for those like me in the future who have had this issue.


Solution

  • I have found out a way to do this. Instead of using things like cookies, local storage, etc., we could use "Indexed DB". Personally, this worked for me and I am pretty sure almost or even all browsers have compatibility for it. This is for those like me in the future who have had this issue.