Caching nav state for ios PWA


#1

Hey folks,

I’m using ionic to create a PWA, however I’m running into trouble on iOS. The current state is dropped as soon as a user leaves the app, so even if an app is briefly swapped, you end up back at the root page. Android thankfully doesn’t have this issue.

Is there any way of storing the current nav state in localStorage or indexedDB, and then re-injecting it into the app when the user re-opens the app so it restores their last view?


#2

Which iOS version?

Maybe your issue is linked to the fact that service workers were just released on iOS 11.3 and that you are testing on a previous iOS version?


#3

I haven’t tested with 11.3 yet, will do later today, but according to this summary on how things are with 11.3, nothing has changed:
“Your PWA won’t keep state between sessions, if the user gets out of a PWA, it will be restarted when coming back, so if you need the user to validate an email, SMS or do a two-factor authentication, have that in mind to offer a proper solution.”


#4

You are right, maybe it gonna be the same on iOS 11.3. I would be curious about the result if you don’t mind trying

with this you mean actually closing (“killing”) the app or just put in the background?

sorry actually I don’t have then an answer but really looking forward to the next posts here


#5

"iOS reloads PWAs every time they get on screen"

See: https://medium.com/@firt/pwas-are-coming-to-ios-11-3-cupertino-we-have-a-problem-2ff49fd7d6ea
And: https://stackoverflow.com/questions/6930771/stop-reloading-of-web-app-launched-from-iphone-home-screen

"iOS 11.3 update"
See: https://medium.com/@firt/progressive-web-apps-on-ios-are-here-d00430dee3a7

The camera issue has been fixed in 11.3: iOS 11 its not me its you (tags: iOS11, PWA, Camera)

Ionic 3 PWA (iOS and Android screen shots): https://craftbeer.org.au/


Persisting state for ionic PWA
#6

Yep, still the same in Ios11.3

Does anyone know how to save ionichistory and then restore it?


#7

Maybe you could try opening an issue/support request in the ionic-pwa-toolkit project?

Btw. just had a test too, is it possible that PWAs on iOS even don’t maintain storage values respectively that the storage is empty each time the PWA start? Do you face this too?