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

前端 未结 7 2054
礼貌的吻别
礼貌的吻别 2021-01-29 19:16

The problem:

I need a device agnostic (e.g. HTML5) solution for storing and querying 250,000+ rows of data offline on a phone or tablet type device (e.g

7条回答
  •  难免孤独
    2021-01-29 20:18

    Why not write a simple storage engine in javascript (which covers the "standards-based" part)? Apparently you don't need anything very fancy, so it should not take too much effort to have it working.

    I would do the following:

    • Store everything in bson or a similar binary format.
    • Parse and create indexes in files, and read at startup.
    • Query using javascript and read from the big file from your (offline obviously) web application.
    • Store updated objects separately.

    This solution is only feasible if the database is simple enough. But I think it might work -- javascript support is good on mobile devices.

    For inspiration here is a Btree+ implementation in javascript.

    To read the local files you will need the file API, which can be used to access local files. It is supported in most modern browsers, even Safari 6. I have not been able to determine if current iPhone browsers support this API though.

提交回复
热议问题