Filter_CSS样式加载失败,浏览器异常"Resource interpreted as Stylesheet but transferred with MIME type text/html"

异常原因:

在编码过滤器中添加了

response.setCharacterEncoding("text/html; charset=UTF-8");

将所有类型的资源都强行转换成text/html,所以css文件失效。

解决方法

  1. 删掉这一句,在具体使用时单独设置
  2. 或者在过滤器中增加判断,如果以.css结尾的文件,直接放行。
发布了340 篇原创文章 · 获赞 23 · 访问量 3万+

猜你喜欢

转载自blog.csdn.net/Chill_Lyn/article/details/104112559