Sunday, February 28, 2010

HTML5 browser support

The emergence of the HTML5 specifications has gotten me all excited about the future of web pages and the possibility of web applications finally catching up with their desktop counterparts (in terms of speed and richness). For just getting my hands a little dirty with the "magical" HTML5 dust, I decided to quickly write up some sample code to detect some features I thought were important. Of course, I have skipped quite a few (I haven't read the complete specs yet).

If you want to take a look at what I've coded up, click here to download the files. The Html5Detect object queries most properties as simple getter functions.

The following table lists some of the HTML5 elements and properties supported in 4 of the latest browsers (Windows versions only tested here):

PropertyChrome4Opera10Safari4Firefox3.5
canvasTRUETRUETRUETRUE
canvasTextTRUEFALSETRUETRUE
videoTRUEFALSETRUETRUE
h264 videoprobablyFALSEprobablyFALSE
OGG videoprobablyFALSEFALSEprobably
localStorageTRUEFALSETRUETRUE
workersTRUEFALSETRUETRUE
applicationCacheFALSEFALSETRUETRUE
geoLocationFALSEFALSETRUETRUE
placeholderTRUEFALSEFALSEFALSE
autofocusTRUETRUETRUEFALSE
microdataFALSEFALSEFALSEFALSE
inputTypes.searchTRUEFALSETRUEFALSE
inputTypes.numberTRUETRUETRUEFALSE
inputTypes.rangeTRUETRUETRUEFALSE
inputTypes.colorTRUEFALSEFALSEFALSE
inputTypes.telTRUEFALSETRUEFALSE
inputTypes.urlTRUETRUETRUEFALSE
inputTypes.emailTRUETRUETRUEFALSE
inputTypes.dateFALSETRUEFALSEFALSE
inputTypes.monthFALSETRUEFALSEFALSE
inputTypes.timeFALSETRUEFALSEFALSE
inputTypes.datetimeFALSETRUEFALSEFALSE
inputTypes.datetimeLocalFALSETRUEFALSEFALSE

For all values of "probably", I haven't tried them out myself yet, but that's the value the detection returns. "probably" indicates that the browser is fairly confident that it can play this format. IE8 doesn't support any of the HTML5 elements I've tested for.

Let me know if there are any other browsers you would like to see included in this list. For further reading, I'd recommend following the HTML5 specification itself, as it is rapidly evolving.

Cheers.