javascript – What feature(s) of HTML5 and HTML 5.1 determine the confidence to work with the browser that supports it?


It is well known that HTML5 is born with the possibility of creating Canvas and Microdata , therefore; I assume that knowing support for HTML5 is:

var HTML5Supported = !!(window.HTMLCanvasElement && window.CanvasRenderingContext2D && document.getItems);

While in HTML5.1 , searching the Web; we could detect Canvas 3D :

var HTML51Supported = !!window.WebGLRenderingContext && WebGLRenderingContext.hasOwnProperty('prototype');

This last one I am not sure that it is like that, since in Differences between HTML 5.1 and HTML5.0 according to the W3C , I do not find that it is like that.

How do you think version 5.1 of the HTML doctype can be effectively detected?


Not a good idea , no browser currently supports the full HTML 5 standard, much less 5.1.

Detecting the supported HTML version is just as bad practice as detecting the browser or its version.

Instead, decide to search for the features you want to use regardless of the version of HTML/5/5.1, rely on libraries like modernizr .

What is modernize ?


  if (Modernizr.canvas) {
    alert("Este browser soporta canvas!");

  if (Modernizr.webgl) {
    alert("Este browser soporta webgl!");
Scroll to Top