I'm doing a re-skin of and old open source web game, the current game is in HTML, CSS and JavaScript.

I'm trying to redo the save game bit as I can't make sense of it and want something I can understand. I think it's relying on a database or Dropbox? Though I've tried removing the Dropbox links it still seems to work perfectly?

So it works but I don't understand what it's doing and I'd rather want something where I can see how its done, saving the state ie variable values and open panels etc.

  • 1
    \$\begingroup\$ Need way more information before this could be answered. \$\endgroup\$
    – Almo
    Commented Feb 26, 2018 at 22:01
  • \$\begingroup\$ Your question is too broad. As with most programming questions: it depends. JS is not really aware of your local file system, so saving/loading is not straightforward. It would be better to link to or post the code you are working with and ask how to improve it for your specific use-case. \$\endgroup\$ Commented Feb 26, 2018 at 22:03
  • \$\begingroup\$ Abstract it. Have an façade object where you can inject a dependency that handles the storage. Write your code against the façade. Then you can start with an implementation that uses local storage, and if you then want to move to dropbox or something more fancy you can do that. Edit: I am voting to close as tool suggestion. \$\endgroup\$
    – Theraot
    Commented Feb 26, 2018 at 22:17
  • \$\begingroup\$ Possible duplicate of Saving Scores Using Cookies \$\endgroup\$
    – Engineer
    Commented Feb 27, 2018 at 11:19

1 Answer 1


If you don't want the savegames to be actual files, then the easiest method would be to use localstorage. It allows your website to save several MB of key-value pairs in the user's web browser. The main advantages are that this is completely invisible to the user and does not require a server. The main problem with this is that savegame data is bound to the web browser. When the user wants to play on multiple devices, they can not easily transfer savegames.

Another option is to set up a server with a web API which stores the game states in a database. This will also require a user account system. The game you used as a template seems to use the Dropbox API for this.

You could also use the Javascript File API. This looks to the user as if they were uploading and downloading files on your website, even though they are only communicating with a local Javascript application. The user would then need to keep their savegames as a file on their device. This is less convenient for the user, but allows them to transfer savegames between devices.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .