平板电脑上已知的 HTML5 localStorage、WebSQL 限制 (webkit)

发布于 2024-11-29 20:40:53 字数 1024 浏览 2 评论 0原文

我即将着手一个针对平板电脑设备的项目 - 本质上是一堆“调查”,需要才能离线工作

限制:

  • 希望与设备无关
  • 希望也能在桌面上工作
  • 需要存储 10-25Mb 的数据

因此有几个选项...例如

A.) 我可以使用像 PhoneGap 以便我可以部署到多个平台并获得包装器的扩展优势。

B.) 我可以完全原生,但需要为多个平台编写重复的代码,而且我没有桌面版本

c.) 我使用 HTML5(离线和 WebSQL/localStorage)(是的,我知道 WebSQL /IndexedDB 辩论,但目前“在基于 webkit 的浏览器上工作”就足够了)

我非常倾向于选项(C),因为我真的很想将其作为基于 Web 的应用程序运行 - 但我还没有涉足太多离线支持/WebSQL。我在 StackOverflow 上读过类似的问题,这些问题表明 5Mb 用于 localStorage,以及我尝试创建 8 或 15Mb DB 提示的简短测试(在iOS/Safari)用户分别允许 10Mb 或 50Mb - 我认为这将是足够的空间。

在我深入研究这个问题并致力于这个 HTML5 方向之前,我想从已经勇敢面对这些水域的其他人那里了解是否有任何我应该注意的已知陷阱?

1 .) 其他开发人员成功推送的数据库大小是多少?

2 .) 用户是否会因为意外删除数据库、localStorage 或缓存而搬起石头砸自己的脚?

3 .) 是否有任何平板电脑设备“理论上”应该能够处理实际上存在问题的问题?

I'm about to embark on a project targeted at tablet devices - essentially a bunch of "surveys", that need to work offline.

Constraints:

  • Hopefully device agnostic
  • Hopefully work on a desktop too
  • Needs to store 10-25Mb worth of data

As a result there are several options... e.g.

A.) I can use a framework like PhoneGap so that I can deploy to multiple platforms and have the extended benefits of the wrapper.

B.) I can go entirely native, but then need to write duplicate code for multiple platforms and I don't have a desktop version

c.) I use HTML5 (offline and WebSQL/localStorage) (yes I'm aware of the WebSQL/IndexedDB debate, but for now "working on webkit based browsers" is sufficient)

I'm heavily leaning on option (C) as I'd really like to run this as a web based application - but I haven't dabbled much into offline support/WebSQL. I've read similar questions on StackOverflow that indicate a cap of 5Mb for localStorage, and my brief tests of attempting to create an 8 or 15Mb DB prompt (on iOS/Safari) the user to allow 10Mb or 50Mb respectively - which I think will be enough space.

Before I dive deep into this and commit to this HTML5 direction I want to know from others that have braved these waters already if there are any known gotchas that I should be aware of?

1 .) What size DB's have other developers successfully pushed to?

2 .) Can users accidentally delete a database, localStorage, or the cache and shoot themselves in the foot?

3 .) Are there any tablet devices that should "theoretically" be able to handle this that actually have issues?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

ㄟ。诗瑗 2024-12-06 20:40:53

您不应将关键数据存储在移动设备上的 localStorage 或基于 Web 的数据库中。就像网络浏览器一样,用户可以随时删除缓存。理想情况下,尝试只保留可以即时重新下载的内容,或者“可以”丢失的内容。

  • Cookie 替换
  • 缓存数据
  • “加星标”(或保存)数据

在我的应用程序中,我从不需要存储超过 5MB 的数据,但我知道这是 iPhone 上的软限制。发生这种情况时,将要求用户增加数据。

You should not store critical data in the localStorage or web-based database on a mobile device. Just like a web browser, users can remove their caches at any time. Ideally, try to keep only things which can be re-downloaded on the fly, or are "okay" to lose.

  • Cookie replacement
  • Cached data
  • "Starred" (or saved) data

In my applications, I never need to store more than 5MB of data, but I know this is the soft limit on the iPhone. Users will be asked to increment the data when this occurs.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文