Skip to content

Instantly share code, notes, and snippets.

@shabith
Created November 22, 2012 02:17
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 shabith/4129070 to your computer and use it in GitHub Desktop.
Save shabith/4129070 to your computer and use it in GitHub Desktop.
Check for HTML5 support in browser
/**
* Assume we want to check the placeholder HTML5 feature support in input element.
* Credit should go to Daniel Stocks, I found this on his placeholder plugin
* (https://github.com/danielstocks/jQuery-Placeholder/blob/master/jquery.placeholder.js#L71)
*/
var NATIVE_SUPPORT = !!("placeholder" in document.createElement( "input" ));
/**
* Assume we want to check for HTML5 cavas support.
* Found it on the stackoverflow. http://stackoverflow.com/a/2746983/502748
*
*/
function isCanvasSupported(){
var elem = document.createElement('canvas');
return !!(elem.getContext && elem.getContext('2d'));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment