I'm writing a Chrome app in which users can create and write notes(plain text), I'd like to the notes to be saved offline.
I've learned that there are several storage solutions from html5: localStorage
, Web SQL DB
, Application Cache
. I'd like to know your advice on how to choose from them, considering the size they offer, the speed, and the convenience of use.
localStorage
is by far the simplest solution and it's the one you should use for this task. It allows you to store strings, so as long as your data can be represented as strings - it will work (usual practice is to convert non-string data to json before saving, then parse is back).
WebDB
is your normal database. If you need to run complicated queries on your data across multiple tables, then you can use it. For storing notes it would be an overkill.
Application cache
is something completely different, I don't see how you can apply it here. It is for caching html pages and resources.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With