Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Detect emoji support
* Determine if this browser supports emoji.
* Modified from
* and probobly originally github's javascript source
function doesSupportEmoji() {
var context, smiley;
if (!document.createElement('canvas').getContext) return;
context = document.createElement('canvas').getContext('2d');
if (typeof context.fillText != 'function') return;
smile = String.fromCharCode(55357) + String.fromCharCode(56835);
context.textBaseline = "top";
context.font = "32px Arial";
context.fillText(smile, 0, 0);
return context.getImageData(16, 16, 1, 1).data[0] !== 0;
Copy link

nok commented Aug 16, 2017

var context, smiley; should be var context, smile;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment