Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/87.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html CSS:为什么@font-face不能在firefox上使用?_Html_Css_Firefox_Font Face - Fatal编程技术网

Html CSS:为什么@font-face不能在firefox上使用?

Html CSS:为什么@font-face不能在firefox上使用?,html,css,firefox,font-face,Html,Css,Firefox,Font Face,我的本地空间中有字体,我尝试用css@font-face更改我的html字体,它可以在除firefox之外的任何浏览器上使用。它只是一个简单的html和css文件,我没有像apache这样的服务器 我该怎么修 @font-face { font-family: 'iransans'; src: url('../fonts/IRANSansWeb.woff2') format('woff2'), url('../fonts/IRANSansWeb.woff') for

我的本地空间中有字体,我尝试用css
@font-face
更改我的html字体,它可以在除firefox之外的任何浏览器上使用。它只是一个简单的html和css文件,我没有像apache这样的服务器

我该怎么修

@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');
}
我得到了这个错误:
已阻止跨源请求:同一源策略不允许读取位于的远程资源file:///P:/workspace/karAmuzi/karamuzi%20project%201/fonts/IRANSansWeb.woff2. (原因:CORS请求不是http)。

这是因为Firefox浏览器的一些安全策略。它有一个禁用该策略的简单解决方案。在地址栏中搜索about:config。它将显示一条关于取消浏览器保修并使其不稳定的警告。冒这个险。现在在页面search security.fileuri.strict_origin_policy中,双击它将其布尔值设置为false。这应该可以解决您的问题。

欢迎使用StackOverflow的版本可能重复!不是所有的问题都应该回答。看看Callum链接的问题,这是一个可能的原始问题:如果该任务的每个有效答案都解决了这里的问题,那么这个问题就不应该得到答案。如果你有什么要补充的原始答案,尽一切努力。