sadegh17
sadegh17

Reputation: 13

CSS: Why is @font-face not working on firefox?

I have font in my local space and try to change my html font with css @font-face and it worked on any browser, except firefox. It's just a simple html and css file and i don't have any server like apache.

How should i fix it?

@font-face {
  font-family: 'iransans';
  src:   url('../fonts/IRANSansWeb.woff2') format('woff2'),
         url('../fonts/IRANSansWeb.woff') format('woff'),
         url('../fonts/IRANSansWeb.eot') format('embedded-opentype'),
         url('../fonts/IRANSansWeb.ttf') format('truetype');
}

i got this error: Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at file:///P:/workspace/karAmuzi/karamuzi%20project%201/fonts/IRANSansWeb.woff2. (Reason: CORS request not http).

Upvotes: 1

Views: 2124

Answers (1)

RazorBlade03
RazorBlade03

Reputation: 26

It is because of some security policy for Firefox browsers. It has a simple solution of disabling that policy. Search about:config in address bar. It will show a warning about voiding the browser's warranty and making it unstable. Take that risk. Now in the page search security.fileuri.strict_origin_policy and double click on it to turn its boolean value to false. This should solve your problem.

Upvotes: 1

Related Questions