Chapter 5. Mobile applications: client storage and offline execution

 

Chapter 5 at a glance

Topic

Description, methods, and so on

Page

Web storage and management of simple key/value pair data on client-side local storage Methods:  
 
  • getItem()
  • localStorage
  • removeItem()
  • clear()
140 140 141 142
Indexed database Complex, indexed client-side database functionality Database/object store methods:  
 
  • open()
  • createObjectStore()
  • createIndex()
  • loadTasks
  • objectStore()
  • deleteDatabase()
145 145 146 150 152 155
  Cursor method
  • continue
150
Application cache Enable web applications to be used when client is offline Method:  
 
  • swapCache()
160

Look for this icon throughout the chapter to quickly locate the topics outlined in this table.

This chapter covers

  • Storing data on the client side with the Web Storage API
  • Managing a full client-side IndexedDB database
  • Enabling applications to work offline with the Application Cache API

HTML5 is finally providing the web with a solution to the problem of working offline. Although a plethora of solutions for saving web pages for later use in an offline environment already exist, until now there’s been no solution for using web applications in such a manner. By allowing web applications to store data locally on the client, HTML5 now enables web applications to work without a constant connection to a central server.

5.1. My Tasks: application overview, prerequisites, and first steps

5.2. Managing data with the Web Storage API

5.3. Managing data using IndexedDB

5.4. Creating a web application that works offline: using the applicat- tion cache manifest

5.5. Summary