- Web Storage simply provides a key-value mapping, e.g.
localStorage["name"] = username;. Unfortunately, present implementations only support string-to-string mappings, so you need to serialise and de-serialise other data structures. You can do so using
- Web SQL Database gives you all the power - and effort - of a structured SQL relational database.
- Indexed Database is somewhere in between Web Storage and Web SQL Database. Like Web Storage, it's a straightforward key-value mapping, but it supports indexes like those of relational databases, so searching objects matching a particular field is fast; you don't have to manually iterate through every object in the store.
For a detailed comparison of client-side storage techniques with code demos, see our Client-Side Storage article.
In the Wild
- Dive into HTML5: Storage Mark Pilgrim dives into using the storage APIs.
- MDC: DOM Storage Mozilla Developer Center on Web Storage.
- MDC: IndexedDB Mozilla Developer Center on IndexedDB.
- Mozilla Hacks: offline web applications Creating a todo list manager using localStorage, app cache and offline events.
- Beyond HTML5: Database APIs and the Road to IndexedDB Mozilla explains its views on Web SQL Database and Indexed Database