我发现了这一切:https://stackoverflow.com/search?q=Failed+to+decode+downloaded+font
但是答案没有帮助解决我的问题= /
我在控制台上看到了这个错误:
Failed to decode downloaded font: http://devcomlink.kunena.dev-monkeys.com/components/com_kunena/template/devcomlink/fonts/font-awesome/fontawesome-webfont.woff2
index.php?option=com_kunena&view=category&layout=list&Itemid=129&templateStyle=9:1 Failed to decode downloaded font: http://devcomlink.kunena.dev-monkeys.com/components/com_kunena/template/devcomlink/fonts/font-awesome/fontawesome-webfont.woff
index.php?option=com_kunena&view=category&layout=list&Itemid=129&templateStyle=9:1 Failed to decode downloaded font: http://devcomlink.kunena.dev-monkeys.com/components/com_kunena/template/devcomlink/fonts/font-awesome/fontawesome-webfont.ttf
在Firefox和IE11中,图标总是不加载......
有谁知道如何解决这个问题?
答案 0 :(得分:20)
我正在为以后的观众回答这个问题。如果您正在使用maven-war-plugin,请确保在过滤或maven中排除.woff
和.ttf
文件会使文件损坏。
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<filteringDeploymentDescriptors>true</filteringDeploymentDescriptors>
<webResources>
<resource>
<directory>${basedir}/src/main/webapp</directory>
<targetPath />
<filtering>true</filtering>
<excludes>
<exclude>**/*.woff</exclude>
<exclude>**/*.woff2</exclude>
<exclude>**/*.ttf</exclude>
</excludes>
</resource>
</webResources>
</configuration>
</plugin>
答案 1 :(得分:15)
问题不在于 HTML 或 CSS 代码......必须使用字体文件或服务器强>,
因为普通字体文件应该包含代码,并且可以在浏览器中打开时下载:http://fortawesome.github.io/Font-Awesome/assets/font-awesome/fonts/fontawesome-webfont.eot?v=4.3.0
虽然您的文件在没有任何代码的情况下显示为空,即使已下载:http://devcomlink.kunena.dev-monkeys.com/components/com_kunena/template/devcomlink/fonts/font-awesome/fontawesome-webfont.eot?v=4.3.0
尝试替换文件......
答案 2 :(得分:8)
我有同样的问题,最后设法解决了。它可能对某人有帮助。
我有一个很大的.htacces文件,包含很多RewriteCond
和RewriteRule
个,并且还使用以下行来过滤这些条件中的某些文件夹:
RewriteRule ^(css|functions|js|media|tpl|vendor)($|/) - [L]
添加fonts文件夹(简称为fonts,位于public_html /)后,问题就解决了。
RewriteRule ^(css|fonts|functions|js|media|tpl|vendor)($|/) - [L]
请注意,此行应该在.htaccess文件的顶部才能正常工作。
答案 3 :(得分:4)
与maven-war-plugin
用法类似,如果您使用maven-resources-plugin
,则需要指定不应过滤字体文件扩展名:
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>2.7</version>
<configuration>
<encoding>UTF-8</encoding>
<nonFilteredFileExtensions>
<nonFilteredFileExtension>ttf</nonFilteredFileExtension>
<nonFilteredFileExtension>woff</nonFilteredFileExtension>
<nonFilteredFileExtension>woff2</nonFilteredFileExtension>
</nonFilteredFileExtensions>
</configuration>
</plugin>
从此SO answer获得解决方案。
答案 4 :(得分:2)
为了它的价值,我在共享的Web服务器上遇到了这个问题。我的字体文件和封闭文件夹的权限不正确。让我永远想通了。将文件夹更改为755,将字体文件更改为644。现在工作得很好。
答案 5 :(得分:2)
游戏有点晚了,但这就是我在.NET MVC上修复它应该也适用于WebForms的原因。如果您使用FA或GI来装饰您的登录表单,则会限制Fonts文件夹。您可以在web.config
中提前授予权限<location path="fonts">
<system.web>
<authorization>
<allow users="*" />
</authorization>
</system.web>
</location>
希望这有助于那里的人!
答案 6 :(得分:1)
问题与您的 HTML 或 CSS 代码无关。它必须与字体文件或服务器一起使用。如果您的资源文件没有问题,请在 maven-resources-plugin 中使用以下代码。 将此代码添加到您的 pom.xml 文件中。
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
<excludes>
<exclude>static/vendor/font-awesome/webfonts/**</exclude>
</excludes>
</resource>
<resource>
<directory>src/main/resources</directory>
<filtering>false</filtering>
<includes>
<include>static/vendor/font-awesome/webfonts/**</include>
</includes>
</resource>
</resources>
</build>
答案 7 :(得分:0)
.gitattributes
文件。
这是一个示例:
*.svg text eol=lf
*.eot binary
*.ttf binary
*.woff binary
答案 8 :(得分:0)
这可能是从损坏的文件到服务器问题的多种原因的列表。我只是通过更改为惊人的CDN链接来解决了我的问题。希望有帮助。