博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
cfs_quota_Mobile Safari中的QUOTA_EXCEEDED_ERR
阅读量:2521 次
发布时间:2019-05-11

本文共 1591 字,大约阅读时间需要 5 分钟。

cfs_quota

I've been working on an HTML5 application for the new , writing a tutorial along the way to help all of you create and promote your HTML5 web-powered app.  The HTML5 app uses localStorage to save basic search history, as well as other newer APIs.  While testing my application on my iPhone, I was seeing the following error:

我一直在为新的 HTML5应用程序,并在编写教程的过程中帮助所有人创建和推广HTML5网络驱动的应用程序。 HTML5应用程序使用localStorage来保存基本搜索历史记录以及其他较新的API。 在iPhone上测试应用程序时,出现以下错误:

localStorage.setItem("history", JSON.stringify(myObject));

The error caused my app to break, refreshing the page and rendering the app useless!  After a bit of research, I found that the reason for the error was that my Mobile Safari's Private Browsing was turned on.  You'd expect a silent error when this mode is one, but nope -- simply a bricked app.  Since there's no way to detect if the user's browser is in "Private Browsing" is turned on (feature detection still works), the best solution is to wrap localStorage setters in try {} / catch() {} blocks:

该错误导致我的应用程序损坏,刷新页面并使该应用程序无用! 经过一番研究,我发现该错误的原因是我的Mobile Safari的“私人浏览”已打开。 当这种模式是一种模式时,您会期待一个无声的错误,但不是-仅仅是一个砖砌的应用程序。 由于无法检测用户的浏览器是否处于“私人浏览”状态(功能检测仍然有效),因此最好的解决方案是将localStorage设置器包装在try {} / catch() {}块中:

try {	localStorage.setItem("history", JSON.stringify(myObject));}catch(e) {}

I'm not seeing a better solution at the moment.  Since there's now way to track Private Mode, and certain interactions break in this mode, using try {} / catch() {} blocks appears to be the best solution.

我目前没有更好的解决方案。 由于现在有了跟踪专用模式的方法,并且某些交互在此模式下中断,因此使用try {} / catch() {}块似乎是最好的解决方案。

翻译自:

cfs_quota

转载地址:http://dupwd.baihongyu.com/

你可能感兴趣的文章
hMailServer搭建简单邮件系统
查看>>
从零开始学习jQuery
查看>>
Spring+SpringMVC+MyBatis深入学习及搭建(四)——MyBatis输入映射与输出映射
查看>>
opacity半透明兼容ie8。。。。ie8半透明
查看>>
CDOJ_24 八球胜负
查看>>
Alpha 冲刺 (7/10)
查看>>
一款jQuery打造的具有多功能切换的幻灯片特效
查看>>
SNMP从入门到开发:进阶篇
查看>>
@ServletComponentScan ,@ComponentScan,@Configuration 解析
查看>>
unity3d 射弹基础案例代码分析
查看>>
thinksns 分页数据
查看>>
os模块
查看>>
LINQ to SQL vs. NHibernate
查看>>
基于Angular5和WebAPI的增删改查(一)
查看>>
windows 10 & Office 2016 安装
查看>>
最短路径(SP)问题相关算法与模板
查看>>
js算法之最常用的排序
查看>>
Python——交互式图形编程
查看>>
经典排序——希尔排序
查看>>
团队编程项目作业2-团队编程项目代码设计规范
查看>>