Skip to content

Instantly share code, notes, and snippets.

@towry
Created November 12, 2015 04:40
Show Gist options
  • Save towry/6f33d144427d9389bbff to your computer and use it in GitHub Desktop.
Save towry/6f33d144427d9389bbff to your computer and use it in GitHub Desktop.
detect emoji support
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