Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Which HTML5 offline storage solution should I use for storing user notes in my web app?

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.

like image 314
wong2 Avatar asked Dec 17 '22 12:12

wong2


1 Answers

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.

like image 152
serg Avatar answered Jan 11 '23 23:01

serg