Stiern

Book Review: Introducing HTML5

Everyone’s talking about HTML5 right now. And still, it seems that no one really understands what it is. You could sit down with the spec. Or you could read Remy Sharp and Bruce Lawson’s Introducing HTML5.

Published in July 2010, it’s a fairly new book, divided into 10 easy-to-read chapters written by one of the two authors. The book is kept in a light language, but still is advanced enough to learn something even if you are already familiar with most of HTML5′s features.

The book covers most new features of HTML5, including canvas, multimedia, forms, and storage. Each chapter features great code examples to help you understand the features even better.

The first two chapters of the book are written by Bruce Lawson, and they provide a great overview of the new elements of HTML5 (header, section, article, etc.)—and an excellent explanation (with examples) of the semantic values of these. Before reading this chapter, I found it hard to interpret the very formal phrasing in the spec, but Lawson explains (and discusses) the semantic values of the new elements, making the book perfect for using as a reference.

Chapter 3 gives a great introduction to the use of form elements in HTML5—including information on fallback methods for older browsers, and how to override the default browser settings.

The video element of HTML5 is one of the most discussed right now. In chapter 4, Lawson and Sharp explains how to use both that, and the audio element. You’ll also get some great information on codecs, and they’ll even teach you how to make custom controls for your video player.

If the video element is the poster boy of HTML5, the canvas element is definitely the Han Solo of HTML5.

— Sharp, page 115

Another very discussed part of HTML5 is the canvas element, which provides a 2D drawing API to use in HTML5. Remy Sharp gives examples of how you can use canvas—from drawing lines to animating. However, Sharp also explains that canvas is not necessarily the best part for the job, just because it’s a part of HTML5—be sure to read the infobox about when to use canvas and when to use SVG.

The latter five chapters of the book more or less describe the web application part of HTML5; data storage, offline detection, drag and drop, geolocation, messages, workers, and sockets. These chapters are also the more advanced part of the book. The first chapters will, if you know HTML on advance, basically just give you some new tools to play with. But these guys—they’re the reason HTML5 is awesome.

You’ll learn how to avoid using cookies, and instead using HTML5′s storage options—both session storage and local storage are incredibly handy tools. As Sharp puts it; “In a nutshell, the Web Storage API is cookies on steroids.” You’ll learn how to take advantage of these, and when to use which.

If you’re creating a web application, offline detection also can become quite useful. How awesome is it, that you can let your users use your web app when they’re offline? Sharp leads you through the process of making your web app available even when there’s no internet connection—including all the quirks you need to pay attention to.

One of the cool things about the book is, that Sharp and Lawson dare to criticize the spec—and that is especially expressed in chapter 8: drag and drop. First, you’ll get a little history of the API, and why it’s even a part of HTML5. And even though they don’t like it, they’ll teach you how to use it. The problem with the drag and drop API is, that it’s very hard to implement across browsers, and thus, you’ll often have to fall back to JavaScript.

Chapter 9 is about geolocation, something I guess we’ll see a lot more as mobile devices becomes more advanced. With Gowalla, FourSquare, and Facebook Places, it is obvious that people like to tell about their whereabouts. However, it’s not only a stalker tool, you can really give your visitors a great experience using geolocation—showing nearby places to by your product, etc. The cool thing about it is, that you really don’t need that much code to use it. This chapter explains both how it works and how to use it—in the same light language as the rest of the book is written in.

Even though only the Message API is a part of the spec, Sharp has chosen to include both Message, Sockets, and Workers in the final chapter. Once again, through simple examples you’ll learn how to take advantage of these advanced tools. If you’re serious about creating web applications, you need to look into this chapter.

Conclusion

The great thing about this book—which I by all means will recommend—is, that it not only tells you how to use HTML5, it also tells you why. Why should you use the new input types, why should you use the video element, etc.? On top of that, they relate every part of HTML5 to accessibility—something I would love to pay more attention to in the future.

In a humorous tone, Lawson and Sharp provides what is definitely going to be my HTML5 reference.

Be sure to check out the book website, where you’ll find examples and source code to the book chapters.

2 comments

Leave one yourself

  1. On behalf of Remy, too, I’d like to thank you for a detailed review of the book.

    I’m particularly pleased that you noticed we ” relate every part of HTML5 to accessibility”: it’s something very important to us and we really want developers to use the right tools for the job, rather than just assume (for example) that canvas is a universal fit for every task.

    Cheers!

Trackbacks

  1. [...] nice review of our book was published by Peter Steen Høgenhaug, noting that we “relate every part of HTML5 to accessibility”, which is great as [...]