Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Font awesome not displaying properly on Firefox

I am trying to use a font awesome icon in a widget that is installed on a customers website. The font awesome icons displays correctly in Safari and Chrome but doesnt in Firefox. However, it still displays correctly in Firefox when previewing it on our site. Does this have something to do with how Firefox displays third party fonts across domains?

Any ideas would be greatly appreciated. Thanks.

Note: This was tested using Firefox V9 and above.

like image 975
acmeyer9 Avatar asked May 17 '12 15:05

acmeyer9


People also ask

Why is the font weird on Firefox?

Make sure you haven't enabled a High Contrast theme in the OS settings. you have installed locally and that might be corrupted or are missing some variants. Also, make sure you allow pages to choose their own fonts and that you do not block remote (downloadable) fonts.

Does Font Awesome work in Firefox?

Why Font Awesome doesn't work with Firefox. First off, let's be clear that the issue with Font Awesome and Firefox is restricted to websites that load Font Awesome via a CDN . The reason for the issue is CORS and how it's implemented in Firefox.

How do I fix Font Awesome icons not showing?

If you installed the Free Font Awesome version but try adding Pro icons to your web pages, they won't show. The solution to this is either you use the alternative free icons or upgrade to a Pro subscription/license.


2 Answers

Firefox only allows cross-domain linking of fonts if the server the font is on sends the right CORS headers. And it does this because the spec very clearly says to do it, at http://dev.w3.org/csswg/css3-fonts/#default-same-origin-restriction

like image 186
Boris Zbarsky Avatar answered Oct 30 '22 15:10

Boris Zbarsky


I notice a strange behaviour, probably related to the firefox security policies. I had the same problems with a project configuration like so:

  • /site/html <--- where all the .html files go
  • /site/resources/... <--- where all the css, font, img, js stuff goes

now, I included the font-awesome.min.css in an html file located under the /site/html directory and I experimented your problem. But when you download the Font Awesome package it is shipped with html demo files that actually works in firefox. What's the trick?!

Their project structure has the "resources" folder (they call it "assets") nested inside the "html" folder. This seems to calm down the firefox security policy. Finally, my answer is: get a configuration like the following

  • /site/html <--- where all the .html files go
  • /site/html/resources/... <--- where all the css, font, img, js stuff goes

it worked for me.

like image 40
MaVVamaldo Avatar answered Oct 30 '22 15:10

MaVVamaldo