Introduction

HTML5 is revolutionizing the Web, and now it’s coming to your ebook reader! In this book, I give an overview of three areas of HTML5 that offer great promise to ebook publishers looking to expand beyond traditional text-and-graphic narratives: Canvas, Geolocation, and Audio/Video. After a brief tutorial of the HTML markup and JavaScript code used to implement these features, I transition into some examples that put HTML5 in action:

  • A graphing calculator to display algebraic equations on the Canvas

  • A children’s finger-painting application for drawing pictures on the page

  • A geolocated work of fiction customized with details about the reader’s current location

  • An audio-enabled glossary that lets you click to hear the pronunciation of each term

  • Embedded video content within instructional text to supplement a lesson

  • An interactive MathML quadratic equation solver

  • An SVG-based coloring book

All code for the examples is available for download from GitHub. You can also demo the examples right in your browser by going to http://examples.oreilly.com/0636920022473.

For each topic area, I also discuss the current status of HTML5 compatibility with major EPUB reader platforms (for example, iBooks, NOOK Color/Tablet, Adobe Digital Editions). At the present time, support for HTML5/EPUB 3 is limited, and often quite experimental. But with the release of the EPUB 3 specification in Fall 2011, HTML5 officially became a part of the EPUB standard, and slowly but surely, support for EPUB 3 and HTML5 features has grown through 2012, and hopefully this trend will continue (if not accelerate) in 2013.

If you’re reading the EPUB version of this book, the examples are embedded directly in the ebook, so you can experiment with them as your ereader compatibility permits.

Conventions Used in This Book

The following typographical conventions are used in this book:

Italic

Indicates new terms, URLs, email addresses, filenames, and file extensions.

Constant width

Used for program listings, as well as text within paragraphs that indicates code elements, such as variable or function names, databases, data types, environment variables, statements, and keywords.

Constant width bold

Shows commands or other text that should be typed literally by the user.

Constant width italic

Shows text that should be replaced with user-supplied values.

Indicates a newline in code introduced because of page-width constraints in print and PDF formats. When typing/copying code, the should be ignored and no newline should be entered.

Note

This icon signifies a tip, suggestion, or general note.

Caution

This icon indicates a warning or caution.

Using Code Examples

This book is here to help you get your job done. In general, you may use the code in this book in your programs and documentation. You do not need to contact us for permission unless you’re reproducing a significant portion of the code. For example, writing a program that uses several chunks of code from this book does not require permission. Selling or distributing a CD-ROM of examples from O’Reilly books does require permission. Answering a question by citing this book and quoting example code does not require permission. Incorporating a significant amount of example code from this book into your product’s documentation does require permission.

We appreciate, but do not require, attribution. An attribution usually includes the title, author, publisher, and ISBN. For example: “HTML5 for Publishers by Sanders Kleinfeld (O’Reilly). Copyright 2011 O’Reilly Media, Inc, 978-1-4493-1461-3.”

If you feel your use of code examples falls outside fair use or the permission given above, feel free to contact us at .

A Note on Ereader Compatibility

The ereader marketplace is a dynamic, fast-moving landscape, with new devices often released in six-month cycles, and software and firmware updates often coming even more frequently. While this book strives to keep up to date with the latest state of HTML5 support in major ereading platforms, please make note of its latest release date on the copyright page and the notes in the compatibility sections at the ends of chapters when evaluating the compatibility of different HTML5 features in different ereaders.

The best resource currently online for tracking the state of HTML5 and EPUB 3 compatibility in the ebook ecosystem is the Book Industry Study Group (BISG) “EPUB 3 Support Grid” . This spreadsheet is maintained by the publishing community and volunteer contributors. Feedback can be submitted to .

Safari® Books Online

Note

Safari Books Online is an on-demand digital library that lets you easily search over 20,000 technology and creative reference books and videos to find the answers you need quickly.

With a subscription, you can read any page and watch any video from our library online. Read books on your cell phone and mobile devices. Access new titles before they are available for print, and get exclusive access to manuscripts in development and post feedback for the authors. Copy and paste code samples, organize your favorites, download chapters, bookmark key sections, create notes, print out pages, and benefit from tons of other time-saving features.

O’Reilly Media has uploaded this book to the Safari Books Online service. To have full digital access to this book and others on similar topics from O’Reilly and other publishers, sign up for free at http://my.safaribooksonline.com.

How to Contact Us

Please address comments and questions concerning this book to the publisher:

O’Reilly Media, Inc.
1005 Gravenstein Highway North
Sebastopol, CA 95472
800-998-9938 (in the United States or Canada)
707-829-0515 (international or local)
707-829-0104 (fax)

We have a web page for this book, where we list errata, examples, and any additional information. You can access this page at:

http://oreilly.com/catalog/0636920022473

To comment or ask technical questions about this book, send email to:

For more information about our books, courses, conferences, and news, see our website at http://www.oreilly.com.

Find us on Facebook: http://facebook.com/oreilly

Follow us on Twitter: http://twitter.com/oreillymedia

Watch us on YouTube: http://www.youtube.com/oreillymedia

Acknowledgments

Huge thanks to Brian Sawyer, Kat Meyer, and Joe Wikert for giving me the opportunity to write this overview on HTML5 for publishers. In researching and compiling this piece, I relied heavily on a wealth of wonderful resources from O’Reilly Media, as well as some excellent web references and tutorials; please see the “Bibliography/Additional Resources” sections at the end of each chapter for details and links. In particular, I highly recommend HTML5 Canvas by Steve Fulton and Jeff Fulton for anyone who wants to learn more about Canvas, and the many cited resources by Liza Daly for those looking to learn more about EPUB development.

I’d also like to thank Edie Freedman, Karen Montgomery, Randy Comer, and Mark Paglietti for their work on the HTML5 for Publishers cover (meerkats are awesome!); Dan Fauxsmith, Tim Hinton and Amber Roberts for making the (arguably anachronistic) print version of this title a reality; Ron Bilodeau, Jess Hosman, Nellie McKesson, and Sarah Schneider for their feedback and for assistance testing the book’s examples; Mark Brokering, Molly Sharp, and Andrew Savikas at Safari® Books Online, for all their support of this project; the great community of Twitter folks on #eprdctn, who are an invaluable source of ebook production tips and humor; my parents, for buying me a computer when I was six; and Augustus Jackson and Nancy Johnson, the inventors of modern ice cream.

And finally, special thanks to Adam Witwer for being a great sounding board, and for generously helping me set aside time to work on this project.

Get HTML5 for Publishers now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.