Skip to content
Viktor Gamov edited this page Sep 19, 2012 · 1 revision

#HTML5 and its New APIs

This is the first and only chapter in this book that's dedicated to HTML5. You'll get familiar with some new HTML tags that were introduced to make the markup more semantic. We'll also provide a brief overview of selected APIs that are included in HTML5 spec (Web Storage, WebSQL, Web Sockets, and Web Workers).

The majority of the modern Web browsers already support the current version of HTML5 specification. The question is if the users of your Web application have or rather can have a modern browser installed on their device? There are two groups of users that will stick to the outdated browsers for some time:

  1. Computer illiterate people who are afraid of installing any new software one their PCs. Especially, people of the older generation. "John, after the last visit of our grandson our computer works even slower than before. Please don't let him install these new fancy browsers here. I just need my old Internet Explorer, access to Hotmail and Facebook".

  2. Business users working for large corporations, where all the installations of the software on their PCs is done by professional sysadmins. They say, "We have 50000 PCs in or firm. An upgrade from Internet Explorer version 8 to version 9 is a major undertaking. Internal users work with about a hundred Web on the regular basis. They can install whatever browser they want, but if some of these application won't work as expected, the users will flood us with support requests we're not qualified to resolve". Hence the strategy of using the lowest denominator browser often wins.

In the worst case scenario, Web developers need to make both of these groups happy. Take an online banking - this old couple has to be able to use your Web application from their old PCs otherwise they can transfer their lifetime savings to a different bank which doesn't require the later version of Firefox for online banking.

Does it mean that enterprise Web developers shouldn't even bother using HTML5 that's not 100% supported? Not at all. This means that a substantial portion of their application's code will be will be bloated by the if-statements figuring out what this specific Web browser supports and providing several solutions that keep your application on float in any Web browser. This what makes the job of DHTML developers a lot more difficult than of, say Java developers who know exactly the environment where their code will work. Of you don't install the JavaRuntime of version 1.6 our application won't work. As simple as that. How about asking Java developers writing applications that will work in any runtime released during the last 10 years? No, we're not that cruel.

Do you believe it would be a good idea for Amazon or Facebook to re-write their UI in Java? Of course not unless they want to loose half of their customers who will be scared to death after seeing the message of the 20-step Java installer asking for the access to the internals of their computer. Each author of this book is a Java developer, and we love using Java... on the server side. But when it comes to the consumer facing Web applications it's just not there yet.

So what's the bottom line? We have to learn how to develop Web application that won't require installing any new software on the user's machines. Today it's DHTML or, let's stick to the modern terminology, HTML5 stack.

In the unfortunate event of needing to support both new and old HTML and CSS implementations you can use HTML5 Boilerplate that is not a framework, but a template for creating a new HTML project that will support HTML5 and CSS3 elements but will work event in the hostile environments of the older browsers. It's like broadcasting a TV show in HD, but letting the cavemen with the 50-year old black-and-white tubes watching it too.

HTML Boilerplate comes is a really simple way to start your project pre-packaged with solutions and workarounds offered by well known gurus in the industry. Make no mistake, your codebase may be larger that you wanted - for example, the initial CSS starts with 500 lines accommodating the old and new browsers, but it may be your safety net. Watch this screencast by Paul Irish, a co-creator of HTML5 Boilerplate. You can also read the current version of the [Getting started with HTML5 Boilerplate] (https://github.com/h5bp/html5-boilerplate/blob/v4.0.0/doc/usage.md) on Github.

##Overview of the HTML 5 tags

HTML5 New APIs