Skip to content

Instantly share code, notes, and snippets.

@amiller
Created October 19, 2012 04:39
Show Gist options
  • Save amiller/3916270 to your computer and use it in GitHub Desktop.
Save amiller/3916270 to your computer and use it in GitHub Desktop.
<script>
function supports_canvas()
{
return !!document.createElement('canvas').getContext;
}
function supportsToDataURL()
{
if(!supports_canvas())
{
return false;
}
var c = document.createElement("canvas");
var data = c.toDataURL("image/png");
return (data.indexOf("data:image/png") == 0);
}
var results = "";
if(supportsToDataURL())
{
results="You browser is cool and supports Canvas.toDataURL();"
}
else
{
results="You browser is lame and does NOT support Canvas.toDataURL();"
}
document.write(results);
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment