halfmoonui / halfmoon

Halfmoon is a highly customizable, drop-in Bootstrap replacement. It comes with three built-in core themes, with dark mode support for all themes and components.
https://www.gethalfmoon.com
MIT License
3.01k stars 118 forks source link

Switch from using cookies to localStorage #98

Closed SiddharthShyniben closed 3 years ago

SiddharthShyniben commented 3 years ago

I just read through your javascript and saw that you are using cookies for storing the preferred theme. Why not use localStorage?

Cookies and localStorage serve different purposes. Cookies are primarily for reading server-side, localStorage can only be read by the client-side. So the question is, in halfmoon, who needs this data — the client or the server? The answer is the client.

You're wasting bandwidth by sending all the data in each HTTP header by using cookies.

Is there any compatibility issue? It's pretty much supported everywhere.

See this for more info.

So, by all means move to localStorage.

Toby222 commented 3 years ago

30

SiddharthShyniben commented 3 years ago

I see. Maybe it's better after all. I think i will just modify the js file for my own purposes