I was reading this guide on offline storage for PWA's that described two storage API's, the Cache API and IndexedDB, however it seems that neither storage option is truly persistent. The Cache API is temporary by design, and the IndexedDB data can be wiped when the user clears their browser cache.
So, is it possible to have truly persistent storage in a PWA? What I'm trying to do is this:
- User visits my website on their smartphone and I generate a unique ID in JavaScript.
- They press "add to homescreen" on iOS or press the "add to homescreen" bar on Android.
- The PWA gets added to their phone. At this point, I would like to store that unique ID persistently.
Is there any way that I can do so? Maybe an API that I don't know about? I only need a tiny unique code, since this PWA is not designed to have users log in with cookies.