Created
November 12, 2015 04:40
-
-
Save towry/6f33d144427d9389bbff to your computer and use it in GitHub Desktop.
detect emoji support
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
var emojiSupported = (function() { | |
var node = document.createElement('canvas'); | |
if (!node.getContext || !node.getContext('2d') || | |
typeof node.getContext('2d').fillText !== 'function') | |
return false; | |
var ctx = node.getContext('2d'); | |
ctx.textBaseline = 'top'; | |
ctx.font = '32px Arial'; | |
ctx.fillText('\ud83d\ude03', 0, 0); | |
return ctx.getImageData(16, 16, 1, 1).data[0] !== 0; | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment