我正在尝试解决Chrome警告:
Resource interpreted as Font but transferred with MIME type text/html
我认为它阻止了我的字体的正确加载.我将此代码用于css:
@font-face {
font-family: 'stereofidelic';
src: url('/css/fonts/stereofidelic.eot'); /* IE9 Compat Modes */
src: url('/css/fonts/stereofidelic.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
url('/css/fonts/stereofidelic.woff') format('woff'), /* Modern Browsers */
url('/css/fonts/stereofidelic.ttf') format('truetype'), /* Safari, Android, iOS */
url('/css/fonts/stereofidelic.svg#svgFontName') format('svg'); /* Legacy iOS */
}
@font-face {
font-family: 'bebasneue';
src: url('/css/fonts/BebasNeue.eot'); /* IE9 Compat Modes */
src: url('/css/fonts/BebasNeue.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
url('/css/fonts/BebasNeue.woff') format('woff'), /* Modern Browsers */
url('/css/fonts/BebasNeue.ttf') format('truetype'), /* Safari, Android, iOS */
url('/css/fonts/BebasNeue.svg#svgFontName') format('svg'); /* Legacy iOS */
}
@font-face {
font-family: 'karamuruh';
src: url('/css/fonts/karamuruh.eot'); /* IE9 Compat Modes */
src: url('/css/fonts/karamuruh.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
url('/css/fonts/karamuruh.woff') format('woff'), /* Modern Browsers */
url('/css/fontsh/karamuruh.ttf') format('truetype'), /* Safari, Android, iOS */
url('/css/fonts/karamuruh.svg#svgFontName') format('svg'); /* Legacy iOS */
}
@font-face {
font-family: 'comicnotesmooth';
src: url('/css/fonts/comicnotesmooth.eot'); /* IE9 Compat Modes */
src: url('/css/fonts/comicnotesmooth.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
url('/css/fonts/comicnotesmooth.woff') format('woff'), /* Modern Browsers */
url('/css/fonts/comicnotesmooth.ttf') format('truetype'), /* Safari, Android, iOS */
url('/css/fonts/comicnotesmooth.svg#svgFontName') format('svg'); /* Legacy iOS */
}
@font-face {
font-family: 'singlesleeve';
src: url('/css/fonts/singlesleeve.eot'); /* IE9 Compat Modes */
src: url('/css/fonts/singlesleeve.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
url('/css/fonts/singlesleeve.woff') format('woff'), /* Modern Browsers */
url('/css/fonts/singlesleeve.ttf') format('truetype'), /* Safari, Android, iOS */
url('/css/fonts/singlesleeve.svg#svgFontName') format('svg'); /* Legacy iOS */
}
@font-face {
font-family: 'TravelingTypewriter';
src: url('/css/fonts/TravelingTypewriter.eot'); /* IE9 Compat Modes */
src: url('/css/fonts/TravelingTypewriter.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
url('/css/fonts/TravelingTypewriter.woff') format('woff'), /* Modern Browsers */
url('/css/fonts/TravelingTypewriter.ttf') format('truetype'), /* Safari, Android, iOS */
url('/css/fonts/TravelingTypewriter.svg#svgFontName') format('svg'); /* Legacy iOS */
}
我试着在我的.htaccess中添加任何类型的指令,谷歌搜索我发现许多人的解决方案是添加到.htaccess中:
AddType application/vnd.ms-fontobject .eot
AddType application/octet-stream .otf .ttf
AddType font/otf .otf
AddType font/opentype .woff
但我仍然从Chrome获得相同的警告:
Resource interpreted as Font but transferred with MIME type text/html: "http://mydomain/css/fonts/TravelingTypewriter.woff". index.php:195
Resource interpreted as Font but transferred with MIME type text/html: "http://mydomain/css/fonts/BebasNeue.woff". index.php:195
Resource interpreted as Font but transferred with MIME type text/html: "http://mydomain/css/fonts/TravelingTypewriter.ttf". index.php:195
Resource interpreted as Font but transferred with MIME type text/html: "http://mydomain/css/fonts/BebasNeue.ttf". index.php:195
Resource interpreted as Font but transferred with MIME type text/html: "http://mydomain/css/fonts/TravelingTypewriter.svg". index.php:195
Resource interpreted as Font but transferred with MIME type text/html: "http://mydomain/css/fonts/BebasNeue.svg". index.php:195
在我的本地网络服务器上,一切正常,我不需要任何AddType指令到.htaccess.
这是在stackoverflow.com上建议的24小时谷歌搜索尝试解决方案,但没有运气.
有帮助吗?