浏览器警告Failed to decode downloaded font和OTS parsing error: Failed to convert *** font to ***
昨晚,在做一个自己感兴趣的东西时,发现浏览器报警告,Failed to decode downloaded font以及OTS parsing error: Failed to convert *** font to ***。
但是这个问题从来没有遇到过,在网上找了一会儿答案后,发现了类似的问题回答下有网友猜测是拦截器没通过,所以我检查了shiro的拦截配置:
<property name="filterChainDefinitions">
<value>
/=authc
/index=authc
/logout=logout
/assets/** = anon
/css/** = anon
/fonts/**=anon
/img/**=anon
/**= user
</value>
</property>
但是这个配置理论上是没问题的,所以不是这个问题。
今天在查阅了一些资料后,发现了可能的原因:
在maven的filter解析font文件时,它破坏了font文件的二进制文件格式,导致浏览器解析出错。
解决的思路是:font文件不需要filter,因此我们需要在配置中设置一下(SpringBoot在pom.xml中写入):
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
<resources>
<!-- fonts file cannot use filter as the data structure of byte file will be changed via filter -->
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
<excludes>
<exclude>static/fonts/**</exclude>
</excludes>
</resource>
<resource>
<directory>src/main/resources</directory>
<filtering>false</filtering>
<includes>
<include>static/fonts/**</include>
</includes>
</resource>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.xml</include>
</includes>
</resource>
</resources>
</build>
在经如上所示的配置后,maven在编译项目时不解析font文件,浏览器就不会报警告,字体也可以正常显示。
浏览器警告Failed to decode downloaded font和OTS parsing error: Failed to convert *** font to ***的更多相关文章
- Spring Boot + Bootstrap 出现"Failed to decode downloaded font"和"OTS parsing error: Failed to convert WOFF 2.0 font to SFNT"
准确来讲,应该是maven项目使用Bootstrap时,出现 "Failed to decode downloaded font"和"OTS parsing error: ...
- Spring Boot - Font Awesome OTS parsing error: Failed to convert 字体加载失败
字体文件,加载不出来 解决方案 一 问题是Maven正在过滤字体文件并破坏它们. <resource> <directory>${project.basedir}/src/m ...
- 处理springboot OTS parsing error: Failed to convert WOFF 2.0 font to SFNT
springboot项目中添加了字体等文件后,页面无法识别,浏览器调试窗口报错如下: Failed to decode downloaded font: http://localhost:8080/f ...
- 解决Spring Boot OTS parsing error: Failed to convert WOFF 2.0
<build> <resources> <resource> <directory>${project.basedir}/src/main/resour ...
- chrome浏览器警告:Failed to decode downloaded font:
使用iconfont字体时chrome报错 Failed to decode downloaded font: 在服务器设置一下自己定义MIME类型. 扩展名: .woff Mime类型:applic ...
- Failed to decode downloaded font
碰到如下错误,该错误是开启layui的打印.导出.筛选列时出现的,不能正常显示图标及文字 原因: @参考文章 因为经过maven的filter,会破坏font文件的二进制文件格式,到时前台解析出错 解 ...
- 记一次elementUI Icon 加载无效的问题。并且提示错误 Failed to decode downloaded font:
问题在于webpack的loader中.检查了一下发现有两个相同的file-loader的配置,删除其中一个即可.
- URIError: Failed to decode param '/%PUBLIC_URL%/favicon.ico'
今天搭建antd的项目结构,本来项目是一个基础react项目,结果执行 yarn create umi yarn yarn start 项目启动后访问突然报错URIError: Failed to d ...
- composer 报错:Failed to decode response: zlib_decode(): data error 解决办法
执行命令 composer require particle/validator 报错 Failed to decode response: zlib_decode(): data error 网上推 ...
随机推荐
- Codevs 四子连棋 (迭代加深搜索)
题目描述 Description 在一个4*4的棋盘上摆放了14颗棋子,其中有7颗白色棋子,7颗黑色棋子,有两个空白地带,任何一颗黑白棋子都可以向上下左右四个方向移动到相邻的空格,这叫行棋一步,黑白双 ...
- H3C 使用tracert命令
- Linux 标准 C 类型的使用
尽管大部分程序员习惯自由使用标准类型, 如 int 和 long, 编写设备驱动需要一些小心 来避免类型冲突和模糊的 bug. 这个问题是你不能使用标准类型, 当你需要"一个 2-字节 填充 ...
- vue-learning:13 - js - vue作用域概念:全局和局部
目录 全局作用域:Vue对象 全局api 局部作用域: 实例对象vm 实例api 组件component 组件配置选项 在引入Vue文件时,就相当于拥有了一个全局Vue对象. 在var vm = ne ...
- POJ3237 Tree 树链剖分 边权
POJ3237 Tree 树链剖分 边权 传送门:http://poj.org/problem?id=3237 题意: n个点的,n-1条边 修改单边边权 将a->b的边权取反 查询a-> ...
- KAFKA报错:COMMIT CANNOT BE COMPLETED SINCE THE GROUP HAS ALREADY REBALANCED AND ASSIGNED THE PARTITIONS TO ANOTHER MEMBER
转载:https://www.greenhtml.com/archives/Commit-cannot-be-completed-since-the-group-has-already-rebalan ...
- 在网上找到的一些Java封装的utils类
这是网址:https://github.com/hanyunpeng0521/utils
- 非GUI-Qt程序运行后显示Console(简单好用:在pro文件中加入: CONFIG += console)
----我的生活,我的点点滴滴!! 有很多时候,我们在程序中添加了好Debug信息,方便程序在运行期间打印出一些我们需要的信息或者,想用他来显示一些必要信息时, 那么console就太重要了,曾几何时 ...
- 金蝶handler中 collection 代码片段理解
1,AtsOverTimeBillBatchEditHandler中collection的理解 SelectorItemCollection selectors = new SelectorItemC ...
- IDEA环境使用Git
推送到Github 在设置中登录github账户 点击OK 将项目交给Git管理 之后项目文件就会变成红色 添加文件到暂存区 点击Add之后,项目文件会变成绿色 添加文件到本地仓库 点击Commit ...