0

I am working on an asp.net mvc web application, and i have the following inside my CSS file:-

@font-face {
  font-family: 'Ubuntu';
  font-style: normal;
  font-weight: 400;
  src: url(_tMhxyW6i8lbI7YsUdFlGA.eot);
  src: local('Ubuntu'), url(_tMhxyW6i8lbI7YsUdFlGA.eot) format('embedded-opentype'), url(_xyN3apAT_yRRDeqB3sPRg.woff) format('woff');
}

i have added the fonts and CSS files inside the same folder (Conten/CSS), but when i check the F12 on firefox it mentioned that it can not get the .woff files, although the files are inside the CSS folder ?

Can anyone advice what is causing this issue ? Thanks

John John
  • 1
  • 72
  • 238
  • 501
  • 1
    try giving `absolute` path rather than `relative` path.. – NoobEditor Jan 14 '14 at 10:54
  • but firefox F12 tool mentioned that it can not locate "/Content/css/_xyN3apAT_yRRDeqB3sPRg.woff". so i think it have understand the URL correctly. so the problem is not with the URL. – John John Jan 14 '14 at 11:01
  • I think that you also need the .ttf of the font and possibly the .svg as well, different browsers use different font formats – Pete Jan 14 '14 at 11:06

2 Answers2

1

I had the same issue with MVC.

Here is an answer relating to your question: https://stackoverflow.com/a/7374640/1838483

I solved this issue by adding a MIME Type declaration via IIS Manager .woff application/x-woff. You can also add this in your config file like so:

<system.webServer>
  <staticContent>
    <mimeMap fileExtension=".woff" mimeType="application/x-font-woff" />
    <mimeMap fileExtension=".svg" mimeType="image/svg+xml" />
  </staticContent>    
</system.webServer>
Community
  • 1
  • 1
AfromanJ
  • 3,922
  • 3
  • 17
  • 33
0

Assuming localhost

If you are running the site from local server i.e., localhost, it wont get loaded in forefox

go to -> about:config -> security.fileuri.strict_origin_policy
Set it to false and you would be able to see fonts then!!

Also,giving absolute path url's are far better and suggested option than having a relative path!

NoobEditor
  • 15,563
  • 19
  • 81
  • 112