Save data from a Game in Html5 and Javascript [closed]

1

I would like to know how I can cache a project of mine, because the game works normally, but when I refresh the page, all progress is lost, I would like to know how I can cache this progress is saved in the user's browser.

Note:

  • for example the game Cookie Clicker , which saved progress in the browser.
  • I developed the game in Javascript and HTML
  • Game progress is set to tag <Label> and would like this to be saved.

Thank you in advance!

    
asked by anonymous 03.11.2016 / 14:49

1 answer

1

One of the possible solutions would be to use localStorage

The persist-js library can also be a good alternative; it automatically uses the localStorage if the browser supports it, or cookies if the browser is older.

    
03.11.2016 / 15:59