Best way to detect that HTML5 is not supported

This is the technique used in Modernizr and basically every other library that does canvas work:

function isCanvasSupported(){
  var elem = document.createElement('canvas');
  return !!(elem.getContext && elem.getContext('2d'));
}

Since your question was for detection when it’s not supported, I recommend using it like so:

if (!isCanvasSupported()){ ...

Leave a Comment