Fontawesome Cross起源问题 [英] Fontawesome Cross origin issues

查看:45
本文介绍了Fontawesome Cross起源问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想从CDN加载Fontawesome,但我得到



跨域请求失败。资源访问受到限制



我知道要解决此问题,应添加HTTP标头,但是有什么方法可以避免这样做? / p>

我尝试替换
'../ font / fontawesome-webfont.eot?v = 3.2.0')
具有完整的网址,但由于某种原因它没有帮助。

解决方案

您必须创建 .htaccess

 < FilesMatch。(eot | ttf | svg | otf | woff | woff2)> 
标头集Access-Control-Allow-Origin *
< / FilesMatch>


I want to load Fontawesome from a CDN but I get

failed cross-origin request. Resource access is restricted

I know that to fix this a HTTP header should be added, but is there any way to avoid doing this?

I tried replacing '../font/fontawesome-webfont.eot?v=3.2.0') with full urls but it didnt help for some reason. Is there anything that can be done without the header?

解决方案

You have to create .htaccess file on font folder with this text.

<FilesMatch ".(eot|ttf|svg|otf|woff|woff2)">
  Header set Access-Control-Allow-Origin "*"
</FilesMatch>

这篇关于Fontawesome Cross起源问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆