How to check if a character is supported by the user's browser in JavaScript?

I am creating a website that uses a lot of emojis. The view is similar to the one you are used to seeing with text messages, or on Instagram, Facebook, etc.

Examples: 😄 😘 😂

Of course, not all emojis are supported by all browsers. When they do not appear, they appear as a square with a question mark in the middle like this:

What do you see when there is an unsupported character

Is there anyway in JavaScript that you can tell if the character is supported by the browser, or if it appears, as a question mark above?

+5
source share
2 answers

Browsers do not "support" display of Unicode characters, this is a responsible font. Of course, you can always directly include the font that you want to use to display characters in the emoji section in Unicode with CSS.

Here is a free and open font that emojis can display.

If you want to determine if a font exists, here is a tool for that.

+2
source

As others have noted .. This is not a browser, but a font .. So specify a font that supports all your emotions

+1
source

Source: https://habr.com/ru/post/1241334/


All Articles