The term "Mobile first" has become the accepted approach today. Luke Wroblevski was writing about this early on, check his blog for his writings. One of the main challenges when developing mobile apps is that the internet connection often isn't reliable. Local storage is therefore needed.
IndexedDb is emerging as the technology for local storage. Support isn't yet 100% (see below) but this is improving all the time. IndexedDb is a fairly comprehensive standard so it takes a little while to get used to. The examples below shows how it can be used and there is also a Db
class that can re-used in your projects.
IndexedDb fits well with the fragmentsjs
data-bind technique.
Support for IndexedDb is coming in all major browsers but iOS is known for being buggy and some features are currently (July 2015) missing in some browsers. There is an IndexedDBShim that can be used in browsers lacking full support. This shim uses WebSQL instead of IndexedDb when IndexedDb is missing. Make sure to read this issue before using the shim though.
YDN-DB provides a nice wrapper around IndexedDB. It also uses the IndexedDBShim in cases where IndexedDb support is lacking.
localStorage
and
WebSQL
are the other technologies used for offline storage. localStorage
is a simple key/value store and is supported by almost all
browsers.
WebSQL
is supported by webKit/Blink (Safari, Chrome, Opera) but not by Gecko (FF) and Trident (IE), see
caniuse for the details.