Hi, I am currently making a long game and I need an easy way to specifically save the game with all the data when the html document closes. If there is any way to do this, please help.
Local data won’t work for this because It needs to be able to save the data even when the html game closes.
i’m pretty sure localStorage saves information in the browser, so it should work even after you close/reopen the game.
1 Like
If all else fails you can always do the .txt file method.
How do u do that just for curiosity.
You can download and upload files easily in html, but for wick, you have to copy to clipboard and have the player paste into a file.
for all data you want to be saved, you can store it in an object, convert it to JSON, and then copy it to clipboard (tutorial)
For loading, just get the user’s input, then turn the JSON string back into an object, and set all the relevant variables from there.