2

I am developing an HTML5 web app that is run from a WebView inside an iOS app. Once the users upgrade to iOS7, localStorage stops working and the app (which uses jQuery/jQuery Mobile) just shows the spinner.

I've run some tests using Modernizr and it does not detect support for localStorage in the WebView within the app. This is strange, because it works fine in Safari on the iPad with iOS7.

Has anyone else run into this issue or have a magical fix? The only client-side web storage API that seems to work is Web SQL in iOS7 WebView, and if I can help it I'd rather not have to use that.

pilar1347
  • 188
  • 1
  • 6
  • How is your html page is hosted? – Kyaw Tun Sep 24 '13 at 00:30
  • I am facing this issue too, but only when Cookies are disabled. Otherwise it is working. – san Sep 24 '13 at 05:01
  • The html is running locally within the app. I haven't as of yet had access to the app code, but once I get that I will try enabling/disabling Cookies and see what happens. – pilar1347 Sep 24 '13 at 14:56
  • Accessed the app code and found that indeed CookiesNever was the issue. We were able to change it to allow CookiesAlways and it works! – pilar1347 Sep 24 '13 at 22:06

2 Answers2

2

Try out this cookie policy setting from the gist: https://gist.github.com/steveriggins/6652508

[[NSHTTPCookieStorage sharedHTTPCookieStorage] setCookieAcceptPolicy:NSHTTPCookieAcceptPolicyAlways];
russau
  • 8,928
  • 6
  • 39
  • 49
1

Since upgrading to iOS7 everything stored in localStorage seems to be wiped when the web page reloads.

<script>
function supports_html5_storage() {
  try {
return 'localStorage' in window && window['localStorage'] !== null;
  } catch (e) {
    return false;
  }
}
if(supports_html5_storage()){
 rString=localStorage.getItem("SerialID");
 alert("We have localStorage support "+rString);
 if(rString) if(rString.length>0) alert("SerialID is present");
} else {
 alert("We do not have localStorage support");
}
</script>
Andrew
  • 11
  • 1