CSS @font-face not working with Firefox, but working with Chrome and IE

后端 未结 28 2380
野趣味
野趣味 2020-11-22 06:27

The following code works in Google Chrome beta as well as IE 7. However, Firefox seems to have a problem with this. I\'m suspecting it to be a problem of how my CSS files ar

28条回答
  •  有刺的猬
    2020-11-22 06:50

    LOCALLY RUNNING THE SITE (file:///)

    Firefox comes with a very strict "file uri origin" (file:///) policy by default: to have it to behave just as other browsers, go to about:config, filter by fileuri and toggle the following preference:

    security.fileuri.strict_origin_policy

    Set it to false and you should be able to load local font resources across different path levels.

    PUBLISHED SITE

    As per my comment below, and you are experiencing this problem after deploying your site, you could try to add an additional header to see if your problem configures itself as a cross domain issue: it shouldn't, since you are specifying relative paths, but i would give it a try anyway: in your .htaccess file, specify you want to send an additional header for each .ttf/.otf/.eot file being requested:

    
        
            Header set Access-Control-Allow-Origin "*"
        
    
    

    Frankly, I wouldn't expect it to make any difference, but it's so simple it's worth trying: else try to use base64 encoding for your font typeface, ugly but it may works too.

    A nice recap is available here

提交回复
热议问题