Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member
The specification is still a work in progress, but that does not mean you should be holding off thinking, "Well, I'll wait and see if it gets implemented." HTML5 is happening. We know what's going to be in it. There are pieces of it already implemented in the latest browsers, and there are things we can be doing right now to work with it. So what are these main features? HTML5 brings new tags, new elements, new abilities, and the main areas are better support for video and audio built into HTML itself, so we don't have to use Flash plug-ins, for example.
There is a new element called Canvas that will allow us to draw on the screen directly. There is offline storage support, so web sites can actually store a significant amount of data, meaning they can be used without a connection. There are a whole lot of new form elements for building better forms. There is drag-and-drop support, built-in abilities to drag and drop items, not only within your own pages, but actually between web sites. There is Geolocation, understanding of latitude and longitude built into the language and local storage, being able to store more data than just simple cookies.
And the way that I just do it is just name it inside an if statement. If it exists, this will be regarded as true. Now very important, notice that here I'm not calling the getElementsByClassName. I'm not using the opening and closing parentheses and passing any parameters; I'm just using the name of it inside our if condition. And you can do this with any of the future-facing objects. First check if it exist, and if it does, use it; if doesn't, ignore it or fall back to some backwards-compatible way. For example, if HTML5 video doesn't exist, we can generate some elements to include a Flash Player.
And next up, what I'm going to cover is a very simple way to detect all the HTML5 features that might or might not be available in a browser.
Get unlimited access to all courses for just $25/month.Become a member