4

I am using dynamic fonts (font-face) in an HTML page.

I have seen that sometimes, IExplorer users doesn't have have permission to download fonts. This is a choice of security settings.

Is it possible to detect using Javascript if the browser allows font downloads? In this case I could display an alert or I could use an alternative technique as Cufón.

Thanks!!!

sergio
  • 273
  • 1
  • 2
  • 6
  • You can probe whether the desired font had been set by inspecting the computed style of text that should have the given font face. – marekful Feb 22 '13 at 11:55
  • Thanks... I have tried it using: document.getElementById('test').style.font-family but it doesn't work. Any idea? – sergio Feb 22 '13 at 12:37
  • That's the defined style. To see what the browser actually evaluated the elements style, use `document.defaultView.getComputedStyle`. – marekful Feb 22 '13 at 12:43
  • I have tried this (and curretStyle for Explorer) but it gives me the defined style for the font-family property instead the applied one (it works fine for others properties). But... thank you, cause you've give a good track, there is another way: http://www.lalit.org/lab/javascript-css-font-detect/ – sergio Feb 22 '13 at 13:23
  • Can you please elaborate on how you were able to find the setting is enabled or disabled? – Siva Jan 01 '14 at 00:18

1 Answers1

0

This Web Font Loader will attach Events to your html tag.

Works very good for me.

gies0r
  • 4,723
  • 4
  • 39
  • 50