Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
546 views
in Technique[技术] by (71.8m points)

javascript - QuotaExceededError:Dom异常22:尝试向存储中添加超出配额的内容(QuotaExceededError: Dom exception 22: An attempt was made to add something to storage that exceeded the quota)

Using LocalStorage on iPhone with iOS 7 throws this error.(在iOS 7上使用iPhone上的LocalStorage会抛出此错误。)

I've been looking around for a resolvant, but considering I'm not even browsing in private, nothing is relevant.(我一直在寻找一个解决方案,但考虑到我甚至没有私下浏览,没有任何相关性。) I don't understand why localStorage would be disabled by default in iOS 7, but it seems it is?(我不明白为什么在iOS 7中默认禁用localStorage,但它似乎是?) I've tested on other websites as well, but with no luck.(我也在其他网站上测试过,但没有运气。) I even tried testing it using this website: http://arty.name/localstorage.html , but it doesn't seem like it's saving anything at all for some weird reason.(我甚至尝试使用这个网站测试它: http//arty.name/localstorage.html ,但它似乎并没有因为一些奇怪的原因而保存任何东西。) Has anyone had the same problem, only they've had luck fixing it?(有没有人有同样的问题,只有他们有运气修复它?) Should I switch my storage method?(我应该切换我的存储方法吗?) I tried hard-debugging it by only storing a few lines of information, but to no avail.(我只是通过存储几行信息来尝试进行硬调试,但无济于事。) I used the standard localStorage.setItem() function to save.(我使用标准的localStorage.setItem()函数进行保存。)   ask by NicT translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

This can occur when Safari is in private mode browsing.(当Safari处于私有模式浏览时,可能会发生这种情况。)

While in private browsing, local storage is not available at all.(在私密浏览中,本地存储根本不可用。) One solution is to warn the user that the app needs non-private mode to work.(一种解决方案是警告用户应用程序需要非私有模式才能工作。) UPDATE: This has been fixed in Safari 11 , so the behaviour is now aligned with other browsers.(更新:这已在Safari 11中修复,因此行为现在与其他浏览器对齐。)

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...