简体   繁体   English

从Dropbox访问字体时出现CORS错误

[英]CORS error when accessing fonts from Dropbox

I am trying to access a .ttf file I have hosted on Dropbox with CSS @font-face rule. 我正在尝试使用CSS @ font-face规则访问我在Dropbox上托管的.ttf文件。

This is the code: 这是代码:

@font-face {
   font-family: calculatorFont;
   src: url(https://www.dropbox.com/s/6yufk6p4mmi8q3u/digital-7.ttf?dl=1);
}

And I get this error. 我得到了这个错误。

Redirect from ' https://www.dropbox.com/s/6yufk6p4mmi8q3u/digital-7.ttf?dl=1 ' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. 来自' https://www.dropbox.com/s/6yufk6p4mmi8q3u/digital-7.ttf?dl=1 '的重定向已被CORS政策阻止:请求中没有'Access-Control-Allow-Origin'标题资源。 Origin 'null' is therefore not allowed access. 因此不允许原点'null'访问。

How can I overcome this? 我怎么能克服这个?

Just like dropbox, you can try put your static assets on a github repo, then publish it by enable github page for your repo. 就像dropbox一样,你可以尝试将你的静态资产放在github repo上,然后通过你的repo的enable github页面发布它。 在此输入图像描述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM