At the Forge - HTML5

HTML5 is coming, and it's going to change the way you develop Web apps. Read on to find out how.
Modernizr

As I indicated earlier, it's nice to know that HTML5 is being rolled out in stages, and that we don't need to wait for a complete implementation to be ready, which might take a number of years. However, it also means that each browser supports a slightly different subset of the HTML5 standard, which spells trouble for Web developers aiming to address users with a uniform platform.

Fortunately, there are ways to check with the current browser to see whether it supports each of the features offered by HTML5. However, you probably want to be able to concentrate on developing your application, rather than creating useful and reliable tests. The open-source Modernizr JavaScript framework is simple to download and install (since it's a single .js file), and it allows you to query the browser from within your program, checking to see what functionality is there. For example, if you want to know whether geolocation is supported, you can say:

if (Modernizr.geolocation) {
    navigator.geolocation.getCurrentPosition(handle_position);
}
else
{
    alert("Ack! I have no way of knowing where you are!");
}

Although Modernizr can be a terrific help in identifying what features are available, it doesn't solve the real problem—namely, gracefully handling the lack of such features. I realize Modernizr isn't designed to take on such responsibility, but perhaps someone in the jQuery community (or elsewhere) will create a library (post-Modernizr?) that goes one step beyond Modernizr, allowing us to paper over the differences between browsers, much as Prototype and jQuery did for basic JavaScript functionality several years ago.

Conclusion

HTML5 is coming, and some would say it's already here. If you are creating a Web application, you will do both yourself and your users a big favor by using HTML5. However, doing so does raise questions about which features you can and will include, and which browsers you intend to support. We've seen how Modernizr can help smooth over these differences and keep the Web a universal medium, but doing so will take a bit of work. Next month, I'll look at some features aimed at making the Web a more complete application framework, namely Web sockets (for interprocess communication), workers (for background threading) and local storage.

Reuven M. Lerner is a longtime Web developer, architect and trainer. He is a PhD candidate in learning sciences at Northwestern University, researching the design and analysis of collaborative on-line communities. Reuven lives with his wife and three children in Modi'in, Israel.

______________________

Webinar
One Click, Universal Protection: Implementing Centralized Security Policies on Linux Systems

As Linux continues to play an ever increasing role in corporate data centers and institutions, ensuring the integrity and protection of these systems must be a priority. With 60% of the world's websites and an increasing share of organization's mission-critical workloads running on Linux, failing to stop malware and other advanced threats on Linux can increasingly impact an organization's reputation and bottom line.

Learn More

Sponsored by Bit9

Webinar
Linux Backup and Recovery Webinar

Most companies incorporate backup procedures for critical data, which can be restored quickly if a loss occurs. However, fewer companies are prepared for catastrophic system failures, in which they lose all data, the entire operating system, applications, settings, patches and more, reducing their system(s) to “bare metal.” After all, before data can be restored to a system, there must be a system to restore it to.

In this one hour webinar, learn how to enhance your existing backup strategies for better disaster recovery preparedness using Storix System Backup Administrator (SBAdmin), a highly flexible bare-metal recovery solution for UNIX and Linux systems.

Learn More

Sponsored by Storix