O'Reilly logo

Smashing Mobile Web Development by Greg Avola

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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

Style

Good Use Cases

LocalStorage

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.

Web SQL

Relational

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

Object-oriented

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

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required