I want to add emoji to my site, but hide them if they're not supported on the platform, rather than showing little squares.
I have a feeling that this isn't possible, but does anybody disagree? How can this be done?
C
I want to add emoji to my site, but hide them if they're not supported on the platform, rather than showing little squares.
I have a feeling that this isn't possible, but does anybody disagree? How can this be done?
C
In case if someone is looking for a library, then here is the one
if-emoji
. It uses the same approach Roko has used in his answer.Try to paint a font (in the Emoji range) to
canvas
and read a pixel usinggetImageData
. If the pixel's Alpha channeldata[3]
you're interested-in is not transparent (like for example in the center of ) than might be an Emoji