Borodin Borodin - 1 year ago 56
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'));
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download