Local Storage

Mahdi Alkhatib's picture

H everybody,

which is the best method for using local storage??

as this article

he preferred the websql which has a problem with w3 which I don't know?
now he acknowledges that there is no problem for it on chrome and safari but on firefox and IE, I think symbian also support sqlite.

kind of confused about it

Taxonomy upgrade extras: 
Ivan Chichkov's picture

You have to think what you want.
The Sql is relational DB.
The indexedDB is key/value optimized DB for faster queries.
Local Storages (session and permanent) are also key/value storages, however not using the same transaction/query notions as DBs.
So, questions I would ask myself are:
1. Do I have a need to reuse my queries?
2. How much data I would save locally?
3. What platform I would go for?
If 1 is yes, you need sql or indexed, would say sql, as indexed is only barely supported on Chrome. For who supports sql, go to html5test.com and check mobile browsers tab or access the link from each device you target to get a report on support.
If you do not have huge amounts of data and data is mostly key/value without belonging to logical tables, use localStorage, it is easy and fast, however there are always size limits.
Then, the platform matters. If you are going to target all platforms, do your homework and check how well each supports HTML5 and the storage mechanism you like.
If we are talking about your project, you need sql. However, IE9 has no support for WebSQL API, unless there is a trick to work around limitations...so you exclude WP7 devices from targeted platforms.