Borodin Borodin - 9 months ago 42
Javascript Question

How can I tell whether a 'font-family' request was honoured so that I can substitute an image if necessary?

I have a CSS file that uses

to refer to a font resource on a networked server. Can I write client-side JavaScript that puts an image in place of styled text if a CSS
request fails because the server is unavailable?

Answer Source

I'm partial to this font detection helper:

After including the .js file, here is the example usage:

// Usage
var detective = new Detector();
alert(detective.test('font name'));