Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Detect emoji support
/**
* Determine if this browser supports emoji.
*
* Modified from https://gist.github.com/mwunsch/4710561
* 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;
}
@nok

This comment has been minimized.

Copy link

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
You can’t perform that action at this time.