Elements to Build

You set up your page structure using the jQuery Mobile framework, so you just need to build the content that powers the application for each page. As long as you keep to the standards discussed in the previous chapters, adding pages will be a breeze. It’s important to note that the first <div date-role=’page’> element will be the default start of an application, so you always want that to be the activity feed. We will be building and explaining the following:

HTML5 databases styles and strategies

The HTML5 database for Web SQL

Using transactions to create databases

Databases in HTML5

HTML5 enables you to access permanently and temporarily stored data within the web browser to hold content for cache, queries, and much more. This storage is persistent and remains when the browser is closed or turned off. Table 6-1 compares three different types of databases so you can choose one that best meets your needs:

Table 6-1 Types of Databases

Type of Database


Good Use Cases


Key-pair database

This is good for storing simple settings in the format of X = Y. For example, you would store is_logged_in as yes.



This is good for applications that have multiple tables holding different types of information. Web SQL requires a schema; you need to define the whole structure before using it.



IndexDB is the new database language based off of object-oriented databases. However, it currently ...

Get Smashing Mobile Web Development now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.