in Book reviews, HTML5

[Book review] Pro HTML5 Programming

I heard about this book after attending a presentation on HTML5 by one of its authors, Peter Lubbers. I found his demonstration about the offline cache, a new feature in HTML5, very interesting and so I wanted to know more about HTML5.
The book has an official site :
In my opinion, this book is a good introduction in the new features of HTML5.

In the first chapter, the authors tell us more about the origins of HTML5 (when it started, who works on it, etc). They also introduce the new semantic markup elements (header, section, article …). An HTML5 page with all the new semantic markup elements is coded and styled with CSS.

Chapter 2 digs deeper into the Canvas API. The Canvas element, combined with the Canvas API, enables you to generate graphics, charts, images and animations. The authors show us how to draw a square, a diagonal line, a tree, a curve for a path…

Chapter 3 shows us the new HTML5 tags for audio (<audio>) and video (<video>). They allow us to use audio (mp3, ogg, AAC …) and video (.avi, .flv, .mp4, .mkv, .ogv …) without plugins. All built-in controls are described and illustrated with code samples and screenshots. These code samples contain built-in JavaScript functions and attributes.

Chapter 4 details some of the functions of the Geolocation API and builds an application that consists of a web page with a distance tracker to demonstrate the features of the Geolocation API, with use of longitude and the latitude.

Chapter 5 introduces the postMessage API and the origin security concept. It also explains the improvements brought in XMLHttpRequest Level 2, compared to XMLHttpRequest. There are good practical examples : a chat widget iframe that works with SimpleHTTPServer Web server included with Python and a Web application that uploads geolocation data.

Chapter 6 is the biggest chapter, not surprisingly since the authors work for Kaazing, a company which specializes in WebSocket technology. The HTML5 WebSocket API is illustrated with a few applications that show how HTML5 WebSockets enables streaming real-time data through the WebSocket protocol and the Python WebSocket server.

Chapter 7 takes a look at form controls (new input types such as email, number, date, search …) added in the HTML5 specification.
And a large portion of this chapter examines the validation API in details. So that part of the form validation can be processed at client-side, instead of at server-side.

Chapter 8 is about Web Workers that are used to create Web applications with background processing. It explains what Web Workers are with a good abundance of code samples that illustrate the use of the Web Workers APIs. There are two main samples : one that checks for browser support and then displays a message and another one that has an image-blurring filter within a Web Worker-based Web page.

Chapter 9 explores the Web Storage API through the development of a small Web application that displays the current positions of racers. It is a sort of successor to browser cookies. Objects are either stored in the session (sessionStorage object) or locally (localStorage object).
There is also a small paragraph about the browser database storage with an example of the use of the Web SQL Database (creates and queries a database).

Chapter 10 shows us how to create offline applications with the use of MANIFEST files and it also uses the applicationCache API (cache states and event listeners) to work with the application cache.

Finally chapter 11 discusses the future of HTML5 : 3D graphics (WebGL), new device element, touchscreen device events and peer-to-peer networking.

What I liked the most : Almost every chapter includes a useful table that shows the browsers support for HTML5 features, at the time of the writing of the book. And every time, the authors show us how to detect that a browser supports a new HTML5 feature. I have read other books on HTML5 and I have found that this one has the most descriptions of the new features of HTML5. For instance, some books do not talk at all about Web Workers or Web Sockets. I found the examples relevant enough to make me want to reproduce them. Moreover, the authors have not limited themselves to one browser only to build these examples. They use Firefox, Chrome, Safari …
Finally, most of the HTML5 APIs are clearly explained and in such a way that the reader wants to continue to learn more about these APIs.

What I liked the least : Nothing.

Contents :

* Chapter 1: Overview of HTML5
* Chapter 2: Using the HTML5 Canvas API
* Chapter 3: Working with HTML5 Audio and Video
* Chapter 4: Using the HTML5 Geolocation API
* Chapter 5: Using the Communication APIs
* Chapter 6: Using the HTML5 WebSocket API
* Chapter 7: Using the HTML5 Forms API
* Chapter 8: Using the HTML5 Web Workers API
* Chapter 9: Using the HTML5 Web Storage API
* Chapter 10: Creating HTML5 Offline Web Applications
* Chapter 11: The Future of HTML5

Order it on Amazon