Developing a HTML5 offline storage solution for iOS/Android in 2011 Developing a HTML5 offline storage solution for iOS/Android in 2011 javascript javascript

Developing a HTML5 offline storage solution for iOS/Android in 2011


I would recommend checking out the JayData library, that actually has the exact purpose of creating a storage agnostic data access layer for mobile devices. JayData provides an abstraction layer with JavaScript Language Query (JSLQ) and JavaScript CRUD support and let's you work on the exact same way with different offline and online data store types. JayData supports dealing with complex entities and also entity relationships either locally or remotely.

At the time of writing JayData supports the following stores or protocols: webSQL(sqLite)/IndexedDB/OData/YQL/FBQL.

Your particular problem with different systems providing different storage engines can be easily addressed with the provider fallback feature of JayData: it will use whatever storage layer it can find while still provides the same API toward the consumer code.

With regarding WebSQL being deprecated by 2012: at the time of writing it is WebSQL that still has a 95% device coverage including Samsung SmartTV and amazon Kindle. Check out kindle executing WebSQL unit tests with JayData.


I would checkout CouchBase Lite. It's a near full featured implementation of CouchDB that runs on Android and iOS.

iOS

Android

If you wrapped your App in something like PhoneGap you could create native HTML 5 apps for both platforms and you'd only have to do a tiny bit of Android/iOS specific programming to implement CouchDB.

Pros:

  • Fast View engine for querying across many rows of data.
  • Dirt simple and powerful replication support baked in.

Cons:

  • Key-Value Store - It'll take some time to get used to.


I've made some more research while looking for a solution for my own project. It looks like this library is rather promising: http://nparashuram.com/IndexedDBShim/

It allows to use IndexedDB API having WebSQL behind the scenes.

It's tests pass on recent iPad, iPhone 5, Android 4.2.2.

Hope this helps someone.