Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics

HTML5 game : Save data locally

A topic by Acid Prank created Jan 26, 2018 Views: 6,649 Replies: 8
Viewing posts 1 to 6


I'm wondering if it is possible to save data client side or even server side (I doubt for this one) ? 

I did a quick search and it seems that it is possible to save some data locally : 

Does someone already did on a HTML5 Game here ?  some experience to share ? 

Moderator (1 edit) (+1)

I can tell you that you're on the right tracks. Local storage is the way to go, so go ahead read on that :)

As for my experience, I did a bit of web games years ago when HTML5 wasn't a thing - so you'd usually go for cookies to save and load data. Cookies were very easy to implement but are a mess to work with.


You can use local storage to save data. We currently have an issue where uploading a new build of your game changes the path it lives on, so you might lose your storage depending on how you've saved it.

just out of curiousity is this still an issue?

I'm looking at making an HTML5 game, while I'm alpha/beta testing I'll probably be releasing updates fairly regularly. I don't really want testers to loose their progress for minor changes.


Maybe you can provide a backup feature, just in case they use another computer, or clear the browser data by accident. For example, open a text box and show the saved string and allow the user to copy them. Or download as a file that can be imported later.  

Also localStorage is like cookie, so if you store something on, you can't acces it  from, but you can access it from It depends on the domain name of your linked game.

(1 edit)

That's a good idea, and also a good point! I hadn't thought of access for different domains. 

(3 edits)

I haven't yet tried local storage, but considering this line from the docs "accesses the current domain's local Storage", I worry it doesn't work after "updating" a game (deleting an old file, uploading a new file to a new, randomized directory).

Please correct me if I'm wrong, but wouldn't an update button on an existing file in the dashboard solve this problem? Instead of only new files, or deleting existing files, what about "overwriting" existing files? Keep the old directory the file lives in, delete the contents, and then upload new contents to said directory. This way concepts like PlayerPrefs in Unity's WebGL builds would work. 

I'll try interfacing with local storage from a Unity WebGL build later and update this post if it works for me.


I would like to enquire if uploading an update will ever re-allocate my game to a different domain? My game has an autosave feature, and if domains are switched then I worry that players progress will be lost.

Well, I tried once and it didn't change. But I'm not sure.

This topic has been auto-archived and can no longer be posted in because there haven't been any posts in a while.