本地存储iPad的Safari保证持久? [英] is localStorage on iPad Safari guaranteed to be persistent?

查看:159
本文介绍了本地存储iPad的Safari保证持久?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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



有没有人有任何近期使用此主题的经验,并能评论HTML5的数据库功能在iPad上使用Safari的可靠程度如何?


localStorage 的w3c规范为:h3_lin>解决方案 note:localStorage )专为横跨多个窗口的存储而设计, >超出当前会话。特别是,出于性能原因,Web应用程序可能希望在客户端存储兆字节的用户数据(例如整个用户创作的文档或用户的邮箱)。


在Apple页面上: $ b


Safari支持最新的HTML5离线数据存储功能。您的应用程序可以使用简单的基于键/值的数据存储或强大的SQL数据库将其信息存储在本地计算机上。数据存储在本地,并在Safari的启动中持续存在,因此您的应用程序无需网络连接即可访问数据,从而缩短启动时间并提高整体性能。


< blockquote>

搜索Google(和Yahoo!是因为一些反谷歌怪胎)给我:


在iOS 5.1中,Apple根据操作系统的要求将localStorage文件的位置移动到缓存文件夹中,该缓存文件夹偶尔会进行清理,通常是在空间是短。苹果很可能会阻止localStorage被备份到iCloud。


localStorage无法在IOS-6 Safari中访问。


我无法访问 Safari(带IOS-6的IPad)中的localStorage。
例如,以下代码在Windows中在所有浏览器和iOS(iOS 5上的iPad)上都可以正常工作,但在iOS-6中无法正常工作:
localStorage.setItem(var,5) ;
alert(localStorage.getItem(var));

答案:


我可以通过在iPad上禁用关闭隐私浏览来解决此问题。我遇到了参考文献的解决方案: https://github.com /cloudhead/less.js/issues/312#issuecomment-2994845



I've seen differences of opinion across the web on this. It has been said that starting with iOS 5.1, local data storage for HTML5 content on the iPad is no longer guaranteed to be persistent, however on Apple's current Safari developer pages (https://developer.apple.com/technologies/safari/html5.html), offline persistence is suggested to be guaranteed.

Does anyone have any recent experience with this subject and able to comment on how reliable the database features of HTML5 are with Safari on iPad?

解决方案

This will probably be enough information:

The w3c spec of localStorage is:

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.

And on the Apple page:

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.

And searching Google (and Yahoo! because of some anti-google freaks) gives me:

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"));

Answer:

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

这篇关于本地存储iPad的Safari保证持久?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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