Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Known HTML5 localStorage, WebSQL limitations on tablets (webkit)

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?

like image 728
scunliffe Avatar asked Nov 05 '22 16:11

scunliffe


1 Answers

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.

like image 124
Josh Delsman Avatar answered Nov 14 '22 23:11

Josh Delsman