javascriptcookiessaveloadautosave

Browser cookie storage


I am making a browser game where it is import to save data to keep your progress. This is the code I am using to save each variable:

function autosave() {
  localStorage.setItem("variablename", variablename);
}
setInterval(autosave, 1000);

However, it has come to my attention that browsers such as chrome can only store 50 cookies per domain. Does each variable count as one cookie? If so, how can I work around this.


Solution

  • localStorage and cookies are different.

    If you're curious about the limits of localStorage check out this question.