gpt4 book ai didi

types - 资源被解释为字体但使用 MIME 类型 text/html 传输不会修复

转载 作者:行者123 更新时间:2023-12-04 12:25:18 25 4
gpt4 key购买 nike

我正在尝试解决 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

在我的本地网络服务器上一切正常,我不需要在 .htaccess 中添加任何 AddType 指令。

这是 24 小时的谷歌搜索 + 尝试 stackoverflow.com 上建议的解决方案,但没有运气。

有什么帮助吗?

最佳答案

如果你有 mod 重写,你应该设置如下规则:

RewriteEngine On
RewriteRule !(\.ico\.gif|\.png|\.jpe?g|\.css|\.js|\.php|\.eot|\.svg|\.ttf|\.woff|\.otf|^public/.*)$ index.php [nocase,last]

我使用 Apache 。

关于types - 资源被解释为字体但使用 MIME 类型 text/html 传输不会修复,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14801143/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com