Using Client Side Storage with Web Apps

I’m using the Open Preview Portal to run a web app. When I exit the Composer, and then reopen the Composer workspace, the Preview Portal seems to retain my Client Side Storage!!

Does this mean that my web apps can use Client Side Storage as as a storehouse of collected data? How permanent is this storage? Is this Client Side Storage accessible as a single sqLite file or as a JSON file?

On web Client Side Storage uses your browsers local storage to keep your data. Afaik it doesn’t have an expiration date but there’s some size limitations and you should not expect your data there to be persistent or safe (if you change browser its gone), anyway it’s not a database.

You can see what’s in there if you open your browsers developer tools and navigate to the local storage. e.g. in Chrome open inspector -> Application -> Storage -> LocalStorage ->

1 Like

Just to add to Sasu’s answer; Safari recently added an expiration date that if the user doesn’t visit a website that uses LocalStorage for 7 days, the data is removed. Not sure if Chrome has yet followed suit.

Chrome open inspector -> Application -> Storage -> LocalStorage ->

Yes. Found AppGyver’s Client Side Data right there. And it was JSON formatted.

Question: Since browsers are not currently configured to make saving Client Side Data permanent, I’m looking at different options. Generally speaking would it take very much doing to grab this block of Client Side Data, as an single Object, and save it to a named disk file? Maybe at some point there will be a Save Component in the Component Market, that will allow for the saving of data Objects.

You can’t access the local filesystem from the browser, so while you can generate a file and allow the user to download it, there’s no way to load the data from the filesystem back into the app. The best bet would be to save the offline state to a server and refresh it from there on app load.