Web apps run from the home screen don't share storage with Safari. Demo: 1) Visit https://www.scirra.com/labs/bugs/iosstorage/ 2) Enter the number 123 and press "Save" 3) Add the page to home screen 4) Close Safari and open the home screen app 5) Press "Load" Expected result: text should change to "Loaded: 123" Observed result: text changed to "Loaded: null" 6) In the home screen app, enter the number 456 and press "Save" 7) Close the home screen app and open Safari again to the same page 8) In Safari, press "Load" Expected result: text should change to "Loaded: 456" Observed result: text changed to "Loaded: 123" Our PWA (editor.construct.net) can save entire user projects in to IndexedDB. Users who use the web app risk losing their work due to this bug. It's also inconvenient since details like saved logins are not remembered between the two.
Right now the only working hack (that I am aware of) to get session data over from Safari to Web.app is by using `window.location.query` :-/, documented here: https://stackoverflow.com/questions/21109615/ios7-safari-saving-to-home-screen-and-persist-token/21292179#21292179.
<rdar://problem/38665631>
The current behavior (on Apple platforms) is by design. Home Screen apps are created as isolated entities without shared state with the browser.
I would be surprised if this is really by design, since from the perspective of the user, it looks like a serious data loss issue. In practice users will go through a process like this: 1) Use a web app in Safari, and produce some work in it, which the web app saves to storage for them. 2) Decide they like the web app, so use "Add to homescreen" to access it more conveniently. 3) Load up the homescreen app, but all their work is missing! They will probably panic and contact support asking why did your app delete all their work? 4) Web app developer has to patiently explain that it's iOS that seemingly deleted all their work, and explain how they can go back to the Safari browser to find their work again. At this point they either have to delete the homescreen app and just stick to Safari, or try to figure out how to transfer their work from Safari across to the homescreen app. Given this is a potentially serious data loss issue, the design should be changed - especially since this design could be viewed as an intentional way to hobble web apps and increase pressure to publish to the App Store.