Post

Replies

Boosts

Views

Activity

localstorage on iOS Safari does not persist in iFrames
I'm currently working on a web application which sits inside an iframe for security purposes (protecting user data) and is hosted on other websites. To keep session state for insecure data, we write some data to local storage for user functionality i.e., remembering the user's background colour we save "backgroundColour" as "red".However I have run into the following two issues on iOS Safari which currently work on MacOS Safari and Chrome and internet Explorer 11.---Issue 1: local storage is not retained when I force quit iOS:The user navigates to the host website, www.host.com, which loads my iframe content from a different domain, www.example.comThe user then interacts with the iframe and saves their background colour preferences which I save to local storage.The user then force quits Safari or navigates away and then force quits Safari.Navigate back to the host websiteExpected behaviour: The localStorage contains the backgroundColour propertyActual behaviour: The local storage is empty---Issue 2: using the iframe content on different sites doesn't utilise local storageThe user navigates to the host website, www.host.com, which loads my iframe content from a different domain, www.example.comThe user then interacts with the iframe and saves their background colour preferences which I save to local storage.The user navigates to www.awesomesite.com which also has my iframe content from the domain in step 1, www.example.comExpected behaviour: The local storage is retained between the different sites because the storage is against DNS of the iframeActual behaviour: The local storage is empty---Note: we are not looking at using Cookies.Has anyone experienced this before? Are there any workarounds that people have found? Is this a bug in iOS Safari? Have I done something wrong?Cheers
1
0
7.2k
Oct ’18