How can I check for special character support using javascript?

How to check if a special character is available on a user's computer?

For example: ♥ ♦ ♣ ♠ ♪ ♫ ¶

If the user's browser does not support one of these, a rectangle (󴈿) appears instead of the symbol.

+3


source to share


2 answers


I'm afraid they won't be able to test it, and the added complexity, even if the character is available, browsers (especially IE) might not render it.

On the other hand, the information would not be particularly useful, except perhaps in the sense that you could dynamically change a symbol to an image if it cannot be represented as a symbol.

The best approach to getting your characters to display correctly is to write their stylesheets so they pick the right fonts. This also fixes the problem that the character may be displayed using a font that is not suitable for general design, such as the main font for copying text.



For example, if you need symbols ♥ ♦ ♣ ♠ ♪ ♫ ¶, select the font that contains them and any other symbols you need. It probably only boils down to

body { font-family: Arial, sans-serif; }

      

+2


source


another solution could use google webfonts

http://www.google.com/webfonts



if you see the symbol every other computer [with the latest browser] will see it

-1


source







All Articles