Google字体给出:请求的资源上不存在“Access-Control-Allow-Origin”标头 [英] Google Fonts giving: No 'Access-Control-Allow-Origin' header is present on the requested resource

查看:121
本文介绍了Google字体给出:请求的资源上不存在“Access-Control-Allow-Origin”标头的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图使用谷歌字体奥斯瓦尔德。当我使用推荐的方式将其嵌入到我的页面中时:

 < link href ='http://fonts.googleapis.com/css?family = Oswald:400,300,700'rel ='stylesheet'类型= '文本/ CSS' > Chrome会抛出以下错误:




$ b

$ p> XMLHttpRequest无法加载http://fonts.googleapis.com/css?family=Oswald:400,300,700。请求的资源上没有Access-Control-Allow-Origin标题。原因'http://<<< redacted>>'因此不被允许访问。

这只是Google的错误吗?或者我做错了什么?

解决方案

原来这是与 prefixfree

解决方法是将data-noprefix添加到链接标记,如下所示:

 < link href ='http://fonts.googleapis.com/css?family = Oswald:400,300,700'rel ='stylesheet'type ='text / css'data-noprefix> 


I'm trying to use a google font 'Oswald'. When i embed it into my page in the recommended way:

<link href='http://fonts.googleapis.com/css?family=Oswald:400,300,700' rel='stylesheet' type='text/css'>

Chrome throws the following error:

XMLHttpRequest cannot load http://fonts.googleapis.com/css?family=Oswald:400,300,700. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://<<redacted>>' is therefore not allowed access. 

Is this just a mistake on google's part or am i doing something wrong?

解决方案

Turns out it was a conflict with prefixfree

Solution was to add "data-noprefix" to the link tag, like so:

<link href='http://fonts.googleapis.com/css?family=Oswald:400,300,700' rel='stylesheet' type='text/css' data-noprefix>

这篇关于Google字体给出:请求的资源上不存在“Access-Control-Allow-Origin”标头的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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