Loading and saving part 2
More progress on loading and saving today. I had one more aspect that was bugging me. You could save a zip file, but it would always save it as "download.zip". That's not super great, especially if you have lots of different games you want to release, or deal with. So, I remembered there's a "download" attribute on anchors which let you download whatever the link href connects to, specifying it's name. So now I have it set up where if you download your game, it'll generate a link dynamically with the data in the href as a data: url with the download attribute set to the file name of your choice. It's pretty dang cool when you see it in action.
Here's a simple demo: https://ibrpg-testing.glitch.me/test/zip/saveload.html -- to try this out, type some text in the big textbox. Don't paste war and peace in there or you will freeze your browser. Next, type a name for your zip file and hit save the file.
You should see a link appear that says "click here to download".
Click the link - see the file download.
Now, if you want to get the text back, click "choose files". Choose the zip file you just created. Hit open or whatever.
It will then "upload" the zip file, parse the contents, get the txt file and display it's contents in the div. AMAZING right?
Leave a comment
Log in with itch.io to leave a comment.