Detect Whether a Font is Installed

There will be times when you will want to know whether a particular font is available on a user’s machine. Check out (and play with) the following example:

widget

Click on the check button to see if Times New Roman is installed on your system. You can also replace the default Times New Roman text with the name of another font you are curious about and painstakingly click on the check button again. If the font you specified exists, you will see a dialog telling you so:

widget

If the font you specified does not exist, a dialog will tell you that also. All of this is done entirely using just a few lines of JavaScript with no shenanigans involving applying/removing styles or modifying the DOM.