How to give visitors to a mobile website offline access to CouchDB data?

For users who do not install CouchDB on Android, what is the best practices way of giving them offline access to my CouchDB data (using Node.js)?

Here's my guess: When the user is online, read CouchDB data and output JS object literal listing the data. Store JS object literal in local storage with browsercouch. Offline visitor will then be able to get data from local storage.


That is definitely the best solution for now (May 2011). Hopefully in the near future, this question will be edited to say "just use the mobile Couchbase SDK."

But for now, use localStorage to keep everything you need. A good idea is to remember the seq_id from the database the last time you contacted it. When you go back online, you can query the couch's /db/_changes?since=$old_seq_id and CouchDB will tell you all documents that were added or modified since then.

Finally, in addition to browsercouch, Mikeal Rogers and others are working on IndexedDBCouch, IDBCouch, which is very new but aims to re-implement CouchDB in the web browser (possibly in webkit views one day; I'm not sure). https://github.com/mikeal/IDBCouch

链接地址: http://www.djcxy.com/p/7060.html

上一篇: C win32选项卡控件

下一篇: 如何让访问者通过移动网站离线访问CouchDB数据?