20

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?

13
  • 2
    It seems someone has voted to close this question. I would like to know why. I believe this question in very relevant to Super User (a website to get help with computer troubles) and must not be closed.
    – ADTC
    Commented Jul 7, 2012 at 17:53
  • 1
    I'm voting to close @ADTC because this is an issue more with khancademy not properly doing the research of the compatibility of their site and not a question that can be solved here. Commented Jul 7, 2012 at 22:51
  • 4
    It's sad that simply because I unwittingly tied the problem to the website instead of keeping it purely Firefox/CSS problem from the beginning, now it's not getting merit even after rewording it to untie it from the website and make it purely Firefox/CSS problem. Anyway I have added a counter-example as an update at the end, it may show what the problem is.
    – ADTC
    Commented Jul 9, 2012 at 6:31
  • 5
    I am disappointed with the arrogance combined with lack of understanding here. The issues is actually that Font Awesome will fail in Firefox any time the request for the font file is cross-domain. In other words on any site that uses a CDN to distribute static files.
    – jasonrr
    Commented Jul 10, 2012 at 23:49
  • 3
    "KA were referencing the font files from the wrong location" 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. You are wrong.
    – ADTC
    Commented Jul 12, 2012 at 17:03

3 Answers 3

12

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.

2
  • This answer was created as per request of Sathya in the comment stream below question.
    – ADTC
    Commented Jul 14, 2012 at 20:17
  • 2
    Note that this Firefox problem also affect paths starting with ../.
    – Ben
    Commented Dec 12, 2012 at 20:00
1

Probably not the answer to the posed question, but related enough to help people that end up here with a slightly different problem that produces the same result as shown in the screenshots.

Firefox blocking the use of a font that is on a different (sub-)domain

Also read the comments on that posts, they give good advice.

0

I did the path changes to run IE, Firefox and Chrome correctly, as follows: (URL to see)

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .