ios - iPad Safari 上的 localStorage 是否保证持久?

标签 ios html ipad safari persistence

我在网络上看到了对此的不同意见。据说从 iOS 5.1 开始,iPad 上 HTML5 内容的本地数据存储不再保证持久化,但是在 Apple 当前的 Safari 开发者页面(https://developer.apple.com/technologies/safari/html5.html),建议保证离线持久化。

有没有人最近有这方面的经验并且能够评论 HTML5 的数据库功能在 iPad 上的 Safari 中的可靠性如何?

最佳答案

这可能是足够的信息:

localStorage 的 w3c 规范是:

The second storage mechanism (note: localStorage) is designed for storage that spans multiple windows, and lasts beyond the current session. In particular, Web applications may wish to store megabytes of user data, such as entire user-authored documents or a user's mailbox, on the client side for performance reasons.

在 Apple 页面上:

Safari supports the latest HTML5 offline data storage features. Your application can store its information on the local machine using either a simple key/value-based data store, or a robust SQL database. The data is stored locally and persists across launches of Safari so your application doesn’t need a network connection to access the data, improving startup time and overall performance.

搜索谷歌(和雅虎!因为一些反谷歌怪胎)给我:

In iOS 5.1 Apple have moved the location of localStorage files into a Caches folder which is subject to occasional clean up, at the behest of the OS, typically if space is short. It is likely that Apple have done this to stop localStorage being backed up to iCloud.

localStorage not accessible in IOS-6 Safari

I am not able to access localStorage in Safari (IPad with IOS-6). For example, the following code is working fine in Windows on all browsers and on (iPad with iOS-5) but not in iOS-6: localStorage.setItem("var","5"); alert(localStorage.getItem("var"));

回答:

I was able to fix the issue by turning off private browsing on the iPad. I came across the solution from the reference : https://github.com/cloudhead/less.js/issues/312#issuecomment-2994845

关于ios - iPad Safari 上的 localStorage 是否保证持久?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15114571/

相关文章:

HtmlUnit - 无法从 div 获取 anchor

javascript - 在 iPad(Safari 和 Chrome)上渲染时,为什么 Canvas 中会出现白线?

ios - 在应用程序中访问 iOS 语音识别

objective-c - iOS 4.x 和 5.0 之间的自动调整大小不同

ios - SpriteKit - 为 SKSpriteNode 绘制阴影的最佳方法

javascript - 使用 angularJS 填充输入和文本区域

javascript - YouTube 视频上的叠加图像在 I-pod/I-phone 设备上不可点击

iOS:自定义按钮未显示在 Storyboard 上

ios - 如何保存使用 UIImagePickerController 相机拍摄的照片以便稍后在应用程序中显示?

JQuery 删除验证