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);
}
}
修改注册表、配置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);
}
}
相关文章推荐
- Web布局连载——两栏固定布局(五)
- [div+css]晒晒最新制作专题推广页模板
- 盒子模型
- CSS选择器
- CSS样式优先权
- [css] line-height 百分比单位和数值单位的区别
- Apple官网研究之使用Justify布局导航
- 关于前端的思考与感悟
- 设计更快的网页(三):字体和 CSS 调整
- 纯CSS制作的新闻网站中的文章列表
- 10条影响CSS渲染速度的写法与使用建议第1/3页
- BS项目中的CSS架构_仅加载自己需要的CSS
- 很不错的 CSS Hack 又学了一招
- 发一个css比较清爽的写法
- CSS expression控制图片自动缩放效果代码[兼容 IE,Firefox]
- css布局网页水平居中常用方法
- CSS经典技巧十则第1/2页
- css 兼容性问题this.style.cursor=''hand''
- IE6不能正常解析CSS文件问题的解决方法及原因分析