Resource interpreted as Font but transferred with

2019-01-21 02:36发布

问题:

I followed the Web Fonts tutorial in qooxdoo documentation to add a web font to Font.js , but I notice there is a warning in Chrome's Developer Console:

My code is as follow:

/* ************************************************************************
  #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"
                ]
            }
        ]
    }
  }
});

How can I resolve the browser warning ?

回答1:

According to the W3C spec, the correct MIME type is application/font-woff, so you need to configure your web server to use that when serving .woff files.



回答2:

If you are using an IIS webserver, give this a try:

<system.webServer>
  <staticContent>
    <remove fileExtension=".woff" /> 
    <mimeMap fileExtension=".woff" mimeType="application/font-woff" />
  </staticContent>
</system.webServer>


标签: qooxdoo