title: Persistent local storage in iOS Safari issues
body: <p>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".</p>
  
  <p>However I have run into the following two issues on iOS Safari which currently work on MacOS Safari and Chrome and internet Explorer 11. </p>
  
  <p><strong>Issue 1</strong>: local storage is not retained when I force quit iOS</p>
  
  <ol>
  <li>The user navigates to the host website, <code>www.host.com</code>, which loads my iframe content from a different domain, <code>www.example.com</code></li>
  <li>The user then interacts with the iframe and saves their background colour preferences which I save to local storage. </li>
  <li>The user then force quits Safari or navigates away and then force quits Safari. </li>
  <li>Navigate back to the host website</li>
  </ol>
  
  <p>Expected behaviour: The localStorage contains the backgroundColour property </p>
  
  <p>Actual behaviour: The local storage is empty </p>
  
  <p><strong>Issue 2</strong>: using the iframe content on different sites doesn't utilise local storage</p>
  
  <ol>
  <li>The user navigates to the host website, <code>www.host.com</code>, which loads my iframe content from a different domain, <code>www.example.com</code></li>
  <li>The user then interacts with the iframe and saves their background colour preferences which I save to local storage. </li>
  <li>The user navigates to www.awesomesite.com which also has my iframe content from the domain in step 1, <code>www.example.com</code></li>
  </ol>
  
  <p>Expected behaviour: The local storage is retained between the different sites because the storage is against DNS of the iframe </p>
  
  <p>Actual behaviour: The local storage is empty </p>
  
  <p>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? </p>
  
  <p>Cheers</p>