Skip to main content

On Sale: GamesAssetsToolsTabletopComics
Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

You can do this in plain Javascript. It's basically the same as in Unity.

Example: 

Save the current level 

window.localStorage.setItem('currentLevel', '5');

Read the current level

window.localStorage.getItem('currentLevel');

There are also a couple more methods:

window.localStorage.removeItem('currentLevel');

window.localStorage.clear(); Use this to delete everything in local storage

window.localStorage.key(index); Use this to get the name of the key(variable) name at a specific index, you can use this to loop through all the keys


I think this is great for saving game data, because it's fast, easy to use and all major browsers support it.

You shouldn't save any users' sensitive information using this, because any code on the website can access it. If you will be saving personal information of the users, you should encrypt it.

I don't think this would be a problem, but major browsers usually limit this storage space to 5MB, but since you will be saving plain text, it won't be a problem even for a game which has a lot of data to save.

If you have any other questions or want to help with something I'd be happy to do that :)

Thank you very much. I did not knew that there is a localStorage. I always saved data with Cookies or in a Database but i cant do this because i cant use backend languages on itch.io.

Although you can't use back-end languages on itch.io, you can use a front-end language (such as Javascript) to connect to an API (run by a back-end language on a server) and achieve the same functionality as you would with a back-end language right in the game.