Book Image

HTML5 Multimedia Development Cookbook

Book Image

HTML5 Multimedia Development Cookbook

Overview of this book

HTML5 is the most significant new advancement the web has seen in many years. HTML5 adds many new features including the video, audio, and canvas elements, as well as the integration of SVG. This cookbook is packed full of recipes that will help you harness HTML5’s next generation multimedia features. HTML5 is the future.Whether you’re a seasoned pro or a total newbie, this book gives you the recipes that will serve as your practical guide to creating semantically rich websites and apps using HTML5. Get ready to perform a quantum leap harnessing HTML5 to create powerful, real world applications. Many of the new key features of HTML5 are covered, with self-contained practical recipes for each topic. Forget hello world. These are practical recipes you can utilize straight away to create immersive, interactive multimedia applications. Create a stylish promo page in HTML5. Use SVG to replace text dynamically. Use CSS3 to control background size and appearance. Use the Canvas to process images dynamically. Apply custom playback controls to your video.
Table of Contents (16 chapters)
HTML5 Multimedia Development Cookbook
Credits
Foreword
About the Authors
About the Reviewers
www.PacktPub.com
Preface

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 use the openDatabase method to assign values to a database. The first argument "mymotodb" was the name of the database. The next and required argument was the version number. The number here must match whenever the user attempts to use...