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

3
  • 1
    try giving absolute path rather than relative path.. Commented Jan 14, 2014 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. Commented Jan 14, 2014 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 Commented Jan 14, 2014 at 11:06

2 Answers 2

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> 
Sign up to request clarification or add additional context in comments.

3 Comments

i tried adding this to the web.config file inside my MVC , but i will receive and internal server error, after deploying it into IIS ..
Can you find out what the error message was? Also are you testing this locally?
i added the type to my site MIME type on IIS, and it worked well, thanks
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!

1 Comment

no not local host, the web application is deployed on IIS 7 and i am accessing the server from my PC .

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.