Skip to content

Instantly share code, notes, and snippets.

@jameshibbard
Created September 11, 2012 09:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jameshibbard/3697077 to your computer and use it in GitHub Desktop.
Save jameshibbard/3697077 to your computer and use it in GitHub Desktop.
Check if HTML5 canvas element is supported
function isCanvasSupported(){
var elem = document.createElement('canvas');
return !!(elem.getContext && elem.getContext('2d'));
}
$(document).ready(function() {
if(isCanvasSupported()){
alert("Yay!");
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment