Iphone localStorage" QUOTA_EXCEEDED_ERR"问题 [英] Iphone localStorage "QUOTA_EXCEEDED_ERR" issue

查看:344
本文介绍了Iphone localStorage" QUOTA_EXCEEDED_ERR"问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试在HTML5(localStorage)中使用Client Side Storage for Iphone Application,我完全知道localStorage的 QUOTA (目前 5MB )。

I trying to use Client Side Storage available in HTML5 (localStorage) for Iphone Application , and I'm completely aware of the "QUOTA" associated for localStorage(which is currently 5MB).

现在问题出在我的应用程序上(之前没有存储数据)。尝试将数据存储在localStorage中导致 QUOTA_EXCEEDED_ERR 虽然整体数据的大小小于5 MB(精确到~4.5b(在普通浏览器中使用chrome web inspector找到))

Now the problem is for a my application (with no data previously stored) . trying to store the data in localStorage is resulting in QUOTA_EXCEEDED_ERR although the size of the overall data is way less than 5 MB (~ 4Kb to be precise ( found using chrome web inspector in normal browser) )

任何人都可以分享一下这个数据如何权衡4Kb导致 QUOTA_EXCEEDED_ERR 当相同 5MB的上限

Can anyone Share some light on this that how a data weigh 4Kb is resulting in QUOTA_EXCEEDED_ERR when the upper limit for the same 5MB

请注意,问题仅针对iPhone 所有浏览器甚至 iPhone模拟器没有提示QUOTA_EXCEEDED_ERR错误

Note that the issue is only occurring for iPhone ,all the browsers and even the iPhone Simulator doesn't prompt with QUOTA_EXCEEDED_ERR error

iPhone目前的图片是iPhone 4。

iPhone currently is picture is iPhone 4 .

推荐答案

进入设置 - > Safari并检查隐私浏览是否已打开。如果是,本地存储将无法存储任何内容。以下是为您检查本地存储空间的一些基本代码:

Go into Settings->Safari and check to see if private browsing is on. If it is, local storage will not be able to store anything. Here's some basic code to check local storage for you:

if (!!window.localStorage) 
{
    localStorage.setItem(key, val);
};

另外,你是如何设置它的?您使用的是 localStorage.setItem(key,val),还是尝试 localStorage(key,val)?您的问题可能来自设置错误

Also, how are you setting it? Are you using localStorage.setItem(key, val), or trying localStorage(key, val)? You're problem might be coming from setting it incorrectly

这篇关于Iphone localStorage" QUOTA_EXCEEDED_ERR"问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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