1
I would like to know how I can make a "cache" of a project of mine, because the game works normally, but when updates the page, all progress is lost, I would like to know how I can make this "cache" so that the progress is saved in the user’s browser.
Obs:
- for example the game
Cookie Clicker
, that saved browser progress. - I developed the game in
Javascript
andHTML
- The progress of the Game is placed on
tag
<Label>
and I would like that to be saved.
Thank you very much in advance!
You need to save the information to a cookie. https://mariovalney.com/como-usar-cookies-com-javascript/
– Mauro Alexandre
If you are using pure JS follow @Mauroalexandre’s suggestion, otherwise tell us which framework you are using.
– Genos
You can also use
LocalStorage
, it holds more data than cookies(http://www.w3schools.com/html/html5_webstorage.asp), but there is the possibility that older versions of browsers do not support theLocalStorage
(http://caniuse.com/#feat=namevalue-Storage).– Giovane