How to detect which one of the defined font was used in a web page?

I’ve seen it done in a kind of iffy, but pretty reliable way. Basically, an element is set to use a specific font and a string is set to that element. If the font set for the element does not exist, it takes the font of the parent element. So, what they do is measure the width of the rendered string. If it matches what they expected for the desired font as opposed to the derived font, it’s present. This won’t work for monospaced fonts.

Here’s where it came from:
Javascript/CSS Font Detector (ajaxian.com; 12 Mar 2007)

Leave a Comment