Created
October 19, 2012 04:39
-
-
Save amiller/3916270 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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