Wednesday, 14 December 2011

HTML 5: Is It Time To Adopt It Yet?

The much-vaunted HTML5 is being touted as the best thing since sliced bread, offering speed and increased functionality — is there any value in being an early adopter, or should we wait for browsers to catch up?

What it is

HTML5 is a markup language for presenting structure and content on the internet. It offers features such as canvas, video, or geolocation tags to display images, videos and geolocation for maps, etc. The idea is to define a single language that can be written in HTML or XTHML syntax and to offer APIs for complex web applications. This has been in development at the Web Hypertext Application Technology Working Group (WHATWG) in collusion with the W3C since June 2004.

Advantages and disadvantages

1. Interactivity

HTML5 solves the problems of needing to use a range of added programs and JavaScripts to interact with social networking websites, watch videos and listen to music by offering DOM and HTML support. BUT new software can often crash other packages that relied on old features and code, so the websites that rely on them will have to upgrade, which may cause problems for them. And because of licensing issues, rich media has to be compressed in multiple formats in order to be compatible with most browsers.

2. Clean Code

Keep your code tidy
Keep your code tidy

The more code a browser has to read when decoding a page, the slower it loads. That's why it's best practice to separate your CSS files from your HMTL, JavaScript and other files so there's not a big block o' doom in the source code of your web page. Because it's an effort to consolidate rather than replace earlier versions of HTML and XHMTL markup, it simplifies code. Right now, there are seven doctypes to choose from according to what markup and attributes you want to use.

Some elements are now depreciated, i.e. <center>. Others are restricted because some developers assume that people don't like links directing people to new windows when they click on a link, even though it's widely considered to be best practice for keeping visitors on your site.

These are the doctypes available for HTML4:

HTML 4.01 Strict<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "">

HTML 4.01 Transitional<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "">

HTML 4.01 Frameset<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "">

XHTML 1.0 Strict<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "">

XHTML 1.0 Transitional<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">

XHTML 1.0 Frameset<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "">

XHTML 1.1<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "">

There are seven of them. In HTML5, there's only one:

<!DOCTYPE html>

Upgrading to the HTML5 doctype won’t break your existing markup because all the tags defined in HTML 4 are still supported in HTML5. But it will allow you to use — and validate — new semantic elements like <article>, <section>, <header>, and <footer>. BUT the language is a work in progress, so any of the elements could change at any time, undoing the work of the early adopter.

3. It's already in use and working

In Dive Into HTML5, Mark Pilgrim proudly declares that most, if not all browsers, are already supporting the major structural elements offered by HTML5. Internet Explorer, not known for its leadership in adopting web standards, is already boasting of its compatibility with some of the HTML5 features. BUT not all browsers support all the features. You have to detect the ones that each of the major browsers fails to support and insert code to bludgeon them into submission, but as Ray Villalobos of Planet of the Web points out, these code solutions aren't perfect. It's WAY easier to stick to HTML4 and save yourself a massive headache. It won't fully depreciate for years to come anyway.

4. Data storage

HTML5 provides a fully defined and structured SQL-based database API that can be used for storing data locally, that is client-side. The data can be accessed to support web applications and it can even be accessed offline. It can be used to store e-mails or shopping cart items for an online shopping site. BUT you can't control the data, make copies or back it up because it's buried where the browser stores it. You have to stay on the same computer to use it, and you can't switch browsers or you'll lose it.

5. Client-side scripting

The availability of code script libraries enables anyone who is so inclined to learn about the structure of web pages and the scripts used to make them work. Indeed, this is encouraged as a way to get as many people testing and tweaking the programs as possible. As tech blogger Santiago Valle said in a post in Oshyn,

With HTML5 it should be possible for assistive technologies to expand on the features they can offer their users as they can immediately build up a more detailed understanding of the structure of a page by looking at the HTML5 elements it contains.

Internet security
Cyber security

BUT Peter Wayner at InfoWorld reckons it's a security nightmare. He says,

All of the security holes introduced by letting the user tweak the JavaScript code affect the databases, too. They're wide open and waiting for someone to write a Greasemonkey script or some native code to change the data.

All the problems caused by trolls and hackers would, it seems, be multiplied exponentially by implementing HTML5 and failing to take security into consideration. I can see hackers taking full advantage of this.


Progress is inevitable and W3C is committed to HTML5, but implementing it now means we shall have to add code patches to compensate for weaknesses in the markup and the lack of native support for some features in older browsers. Security is a big concern, and will have to be addressed before we permit people to commit sensitive data to the internet where it can be harvested by phishers and hackers.

No comments:

Post a Comment