O'Reilly logo

HTML5 Multimedia Development Cookbook by Lee Jordan, Dale Cruse

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

Creating a Web SQL Database

In this recipe we will create a web SQL database and give it attributes that define its version, name, size, and description.

Getting ready

You will need to be using a current browser that supports web SQL databases.

How to do it...

Create a new HTML5 file, and place opening and closing script tags between two footer tags. Declare a variable named db, then assign openDatabase() to it. Give openDatabase the following arguments: 'mymotodb', '1.0', 'Motocross Rider List DB', 2 * 1024 * 1024, and then close the declaration. The code should look like the following snippet:

<script>var db = openDatabase('mymotodb', '1.0', 'Motocross Rider List DB', 2 * 1024 * 1024);</script>

Save the file.

How it works...

All web SQL databases ...

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