Firefox cannot render icons from Font Awesome webfont set

firefoxfonts

In Firefox (Windows 7), icons and glyphs that are called from the Font Awesome package do not render properly. An example of this can be seen on the Khan Academy website. Below the video the icons are shown as boxes with hex codes in them. This means that it isn't getting downloaded by Firefox.

How the icons appear in Firefox

How it appears on Chrome (Windows 7), Safari (Mac OS X) and Stainless (Mac OS X):

How the icons appear in other browsers

I found this question on Stack Overflow that may explain why this happens — the CSS does use single quotes to enclose the font's src location. However, I don't have any write access to Khan Academy servers so I can't modify the actual website. I want to know if this can be fixed in Firefox, and how. I can run Greasemonkey scripts if that would help. I've already tried manually downloading the font and adding it to Windows' Fonts folder but this does not help.

For reference, the CSS that sets this font up (not processed properly by Firefox) is:

@font-face
{
  font-family:'FontAwesome';
  src:url('./fontawesome-webfont.eot');
  src:url('./fontawesome-webfont.eot?#iefix') format('embedded-opentype'),
      url('./fontawesome-webfont.woff') format('woff'),
      url('./fontawesome-webfont.ttf') format('truetype'),
      url('./fontawesome-webfont.svg#FontAwesome') format('svg');
  font-weight:normal;
  font-style:normal
}

[class^="icon-"]:before,
[class*=" icon-"]:before
{
  font-family:FontAwesome;
  font-weight:normal;
  font-style:normal;
  display:inline-block;
  text-decoration:inherit
}

Update: I found that Firefox correctly displays the font-based icons in Font Awesome package's website (linked above). Upon inspection of CSS and comparison with Khan Academy's CSS, I find that both codes are exactly the same except there is no semicolon after the last attribute for KA's CSS (if you ignore the fact that it's compressed). Does the lack of semicolon cause this problem?

Best Answer

The problem described in the question was fixed by Khan Academy by changing all the paths from ./ to /fonts/ (for example ./fontawesome-webfont.ttf changes to /fonts/fontawesome-webfont.ttf). It seems to me that Firefox is unable to read files from the special "dot" directory (which simply refers to the current directory).

PS: The lack of semicolon in the CSS after the last attribute does not cause this problem.

Additional comments:

Your edit about the . prefix is a server issue, not how Firefox handles files. KA were referencing the font files from the wrong location – random

Incorrect! The fonts worked correctly in three other browsers as I had already mentioned in question long ago, which means the fonts were in the correct location. It was clearly Firefox's problem with the ./ path as I explained, which forced KA to move the font files to a new location that doesn't need ./, allowing Firefox to also read the font files correctly. Therefore it is an issue of how Firefox handles files.

Related Question