localStorage不再适用于iOS 7 WebView [英] localStorage no longer working in iOS 7 WebView

查看:294
本文介绍了localStorage不再适用于iOS 7 WebView的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个从iOS应用程序内部的WebView运行的HTML5 Web应用程序。一旦用户升级到iOS7,localStorage就会停止工作,应用程序(使用jQuery / jQuery Mobile)只显示微调器。

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.

我使用Modernizr进行了一些测试它不会检测应用程序中WebView中对localStorage的支持。这很奇怪,因为它在带有iOS7的iPad上的Safari中运行良好。

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.

是否还有其他人遇到此问题或有神奇的修复?似乎有效的唯一客户端Web存储API是iOS7 WebView中的Web SQL,如果我可以帮助它,我宁愿不必使用它。

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.

推荐答案

从主旨中尝试这个cookie政策设置: https://gist.github.com/steveriggins/6652508

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

[[NSHTTPCookieStorage sharedHTTPCookieStorage] setCookieAcceptPolicy:NSHTTPCookieAcceptPolicyAlways];

这篇关于localStorage不再适用于iOS 7 WebView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆