I need a client side browser database. What are my options

I'm about 5 years late in answering this, but given that there are errors and outdated data in some of the existing answers, and unaddressed points in the original question, I figured i'd throw in my two cents.

First, contrary to what others have implied on here, localStorage is not a database. It is (or should be perceived as) a persistent, string-based key-value store...

...which may be perfectly fine for your needs (and brings me to my second point).

  • Do you need explicit or implicitly relationships between your data items?
  • How about the ability to query over said items?
  • Or more than 5 MB in space?

If you answered "no" to all all of the above, go with localStorage and save yourself from the headaches that are the WebSQL and IndexedDB APIs. Well, maybe just the latter headache, since the former has been deprecated.

There are also several other client-side storage facilities (native and non-native) you may want to look in to, some of which are deprecated* but still see support from some browsers:

  • userData*
  • The rest of webStorage (sessionStorage and globalStorage*)
  • HTML5 File System*
  • Flash Locally Shared Objects
  • Silverlight Isolated Storage

Check out BakedGoods if you want to utilize any of these facilities, and more, without having to write low-level storage operation code. With it, placing data in one (or more) of them, for example, is as simple as:

bakedGoods.set({
    data: [{key: "key1", value: "val1"}, {key: "key2", value: "val2"}],
    storageTypes: ["silverlight", "fileSystem", "localStorage"],
    options: optionsObj,
    complete: function(byStorageTypeStoredKeysObj, byStorageTypeErrorObj){}
});

Oh, and for the sake of complete transparency, BakedGoods is maintained by this guy right here :) .


Indexed Database (Can I use)
Web SQL (Can I use)
localStorage