我按照qooxdoo文档中的Web Fonts tutorial向Font.js添加了一个网络字体,但我注意到Chrome的开发者控制台中有一个警告:
我的代码如下:
/* ************************************************************************
#asset(myApp/fonts/*)
************************************************************************ */
qx.Theme.define("myApp.theme.Font",
{
extend : qx.theme.simple.Font,
fonts :
{
"silkscreen" :
{
size: 8,
lineHeight: 1,
family: [ "silkscreen", "Tahoma" ],
sources:
[
{
family: "Silkscreen",
source:
[
"myApp/fonts/slkscr-webfont.eot",
"myApp/fonts/slkscr-webfont.ttf",
"myApp/fonts/slkscr-webfont.woff",
"myApp/fonts/slkscr-webfont.svg#silkscreen"
]
}
]
}
}
});
如何解决浏览器警告?
答案 0 :(得分:97)
根据W3C spec,正确的MIME类型为application/font-woff
,因此您需要将Web服务器配置为在提供.woff文件时使用。
答案 1 :(得分:85)
如果您使用的是IIS网络服务器,请尝试尝试:
<system.webServer>
<staticContent>
<remove fileExtension=".woff" />
<mimeMap fileExtension=".woff" mimeType="application/font-woff" />
</staticContent>
</system.webServer>