Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Studio Chat / Access to localStorage in Html5 with a modified AGKPlayer.js

Author
Message
Prime
User Offline
Joined: 15th Jun 2022
Location:
Posted: 27th Jul 2022 02:48
Data in cookies is limited to 4KB and localStorage can be used instead to store larger data that persists between sessions.

I have tested a modification to AGKPlayer.js to allow access to localStorage

unminify, then replace


with




as you can see, any shared variable starting with _ls will then be redirected to localStorage, so you might have functions like these



to use files normally or localStorage if you export to Html5

itch.io had an issue with localStorage where data was lost if you uploaded a new build. That issue seems to be fixed, but ymmv.
Prime
User Offline
Joined: 15th Jun 2022
Location:
Posted: 27th Jul 2022 02:52
Also in the modification to AGKPlayer.js you'll see



which makes reading from a shared variable called "args" return the url used to run your app, including parameters which some sites use to pass a userid and/or token so you can get/save data about your player.
Prime
User Offline
Joined: 15th Jun 2022
Location:
Posted: 27th Jul 2022 03:58
https://github.com/charlesgriffiths/agk-modules/tree/main/other/profile

This is my use case and test routine, comments welcome.

The goal of this module is to provide an easy interface to persistent storage with minimal I/O so you could change the three backend functions to use server storage, compress data, or whatever.

Login to post a reply

Server time is: 2022-08-09 09:40:49
Your offset time is: 2022-08-09 09:40:49