什么mime类型应该作为WOFF字体?
我服务truetype(ttf)字体as font/truetype和opentype(otf)as font/opentype,但我找不到WOFF字体的正确格式.
我曾尝试font/woff,font/webopen和font/webopentype,但Chrome仍然会抱怨:
"资源被解释为字体,但使用MIME类型application/octet-stream进行传输."
有人知道吗?
在网上搜索,我找到了大量关于字体的正确MIME类型的不同建议,但我还没有尝试任何可以解决Chrome警告的MIME类型,如下所示:
资源解释为字体但使用MIME类型font/otf传输
字体是OTF.
到目前为止,我已尝试过以下MIME类型
我试图让一个字体在一个文件中呈现,它给我通常的错误
Resource interpreted as Font but transferred with MIME type text/html:
Run Code Online (Sandbox Code Playgroud)
但是展示的HTML文件是我们的404.aspx文件,我尝试在web.config中安装应用程序,然后最终进入IIS本身:
.woff application/font-woff
.ttf application/font-ttf
.eot application/vnd.ms-fontobject
.otf application/font-otf
.svg image/svg+xml
Run Code Online (Sandbox Code Playgroud)
我无法理解我哪里出错了.这些文件存储在一个名为fonts的文件夹中,该文件夹位于该站点的基本目录中,我的样式位于我的aspx文件中
@font-face {
font-family: 'segoe_printregular';
src: url('/fonts/segoepr-webfont.eot'); /* IE9 Compat Modes */
src: url('/fonts/segoepr-webfont.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
url('/fonts/segoepr-webfont.woff') format('woff'), /* Modern Browsers */
url('/fonts/segoepr-webfont.ttf') format('truetype'), /* Safari, Android, iOS */
url('/fonts/segoepr-webfont.svg#svgFontName') format('svg'); /* Legacy iOS */
font-weight: normal;
font-style: normal;
}
Run Code Online (Sandbox Code Playgroud)
和fonts文件夹中的stylesheet.css如下:
@font-face {
font-family: 'segoe_printregular';
src: url('/segoepr-webfont.eot'); /* IE9 Compat Modes */
src: url('/segoepr-webfont.eot?#iefix') format('embedded-opentype'), /* …Run Code Online (Sandbox Code Playgroud) 我使用Meteor Framwork(PREVIEW 0.7.1.2),我已经使用mrt安装了bootstrap-3,一切正常,但是从chrome iam的控制台接收到这个警告:
Resource interpreted as Font but transferred with MIME type text/html: "http://localhost:3000/fonts/glyphicons-halflings-regular.woff"
Resource interpreted as Font but transferred with MIME type text/html: "http://localhost:3000/fonts/glyphicons-halflings-regular.ttf".
Resource interpreted as Font but transferred with MIME type text/html: "http://localhost:3000/fonts/glyphicons-halflings-regular.svg".
Run Code Online (Sandbox Code Playgroud)
特别是在为控制台开发时非常烦人,
有没有人解决这个问题?谢谢
我不确定这是否是发布这个的正确位置,因为我不知道问题出在哪里.基本上字体对我来说是一个真正的痛苦,没有任何工作.我已经尝试从谷歌字体加载字体并遇到IE的问题所以我决定下载它们并自己提供它们但现在它不能在任何浏览器中工作我收到错误:
"NetworkError:403 Forbidden - http://www.mychic.co.uk/includes/templates/SmartStart/fonts/architectsdaughter-webfont.woff""NetworkError:403 Forbidden - http://www.mychic.co.uk/ includes/templates/SmartStart/fonts/architectsdaughter-webfont.ttf "
我尝试过使用permisssions来提供对文件的读取和执行权限,甚至尝试过777并且仍然得到相同的错误,字体肯定是它们应该在哪里,我的css看起来像这样:
@font-face {
font-family: 'architects_daughterregular';
src: url('../fonts/architectsdaughter-webfont.eot');
src: url('../fonts/architectsdaughter-webfont.eot?#iefix') format('embedded-opentype'),
url('../fonts/architectsdaughter-webfont.woff') format('woff'),
url('../fonts/architectsdaughter-webfont.ttf') format('truetype'),
url('../fonts/architectsdaughter-webfont.svg#architects_daughterregular') format('svg');
font-weight: normal;
font-style: normal;
}
body { font-family: 'architects_daughterregular'; }
Run Code Online (Sandbox Code Playgroud)
有人建议我添加一个.htaccess文件,所以我已经将以下内容添加到站点的根目录和fonts目录中(这是正确的):
AddType application/vnd.ms-fontobject .eot
AddType application/x-font-ttf .ttf
AddType application/x-font-woff .woff
Run Code Online (Sandbox Code Playgroud)
我在这里做错了什么想法 - 任何帮助/想法都非常感激?