您的位置:首页 > Web前端 > CSS

IE9 IE10 SEC7113: CSS 因 Mime 类型不匹配而被忽略

2016-04-26 18:27 531 查看
浏览器将css的文件的content-type类型识别成了text/plain,但 产生此问题的根本原因未找到。

修改注册表、配置web.xml、配置tomcat都无效。

最后只能添加或修改filter,将content-type修改成 text/css

import org.springframework.web.util.UrlPathHelper;
public class LocaleFilter extends OncePerRequestFilter { 
public void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain chain) throws IOException, ServletException {

//chain.doFilter(request, response)前边添加此段代码
UrlPathHelper urlPathHelper = new UrlPathHelper();
String path = urlPathHelper.getPathWithinApplication(request);
if(path.endsWith(".css")){
response.setContentType("text/css");
}
//end
chain.doFilter(request, response);

}
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  css ie 10 ie 9 SEC7113 Mime