zoukankan      html  css  js  c++  java
  • css文件的MIME错误引发的Jquery Mobile绘制错误

    静态文件serve设置的MIME不对,引起的浏览器警告

    Resource interpreted as Stylesheet but transferred with MIME type application/octet-stream: "http://wx.yinghuan.com/yhzh/static/css/themes/yh.jqm.theme1.min.css".

    同时页面绘制不正常,jquery mobile的页面根本没有绘制出来,调试发现是css没起作用。调试服务器端代码,发现serve静态文件的程序中使用了javax.activation.MimetypesFileTypeMap来获取文件的MIME类型,但是MimetypesFileTypeMap默认不支持css和js文件,都相应为“application/octet-stream”,需要自己添加mime类型。google一翻,终于找到了添加MIME类型的文本格式:

    MimetypesFileTypeMap mmMap = new MimetypesFileTypeMap();
    mmMap.addMimeTypes("text/css css CSS");
    mmMap.addMimeTypes("text/javascript js JS");

    问题解决。

  • 相关阅读:
    sql注入之payload
    cve2019-0708漏洞复现
    xss学习
    kernel panic not syncing
    nodeJS爬虫
    JS刷题自制参考知识
    HTML Cookie
    点击按钮触发div颜色改变的几种写法
    Bootstrap4布局(简要)
    jQuery实现论坛发帖Demo
  • 原文地址:https://www.cnblogs.com/dajianshi/p/6496265.html
Copyright © 2011-2022 走看看