javascript - 拒绝应用样式,因为它的 MIME 类型('application/octet-stream')
问题描述
我在使用版本控制时导入 css 和 javascript 时遇到问题。看来,当我使用 styles.css 和 script.js 时,一切正常,但是当我使用styles.css?v=1.1或script.js?v=1.1时- 我收到以下错误。
Refused to apply style from 'url/goes/here/styles.css?v=1.1' because its MIME type ('application/octet-stream') is not a supported stylesheet MIME type, and strict MIME checking is enabled.
Refused to execute script from 'url/goes/here/script.js?v=2.1' because its MIME type ('application/octet-stream') is not executable, and strict MIME type checking is enabled.
这可能是什么原因?!
它们是这样导入的:
<link rel="stylesheet" type="text/css" href="url/goes/here/styles.css?v=1.1">
<script type="text/javascript" src="url/goes/here/script.js?v=1.1"></script>
解决方案
我认为问题出在服务器上,"content-type"
将 css 文件更改为"text/css"
js 文件更改为"text/javascript"
,应该可以解决问题
推荐阅读
- javascript - JSP Json ArrayList 转 JavaScript 列表
- sqlite - SQLite 选择列名包含字符串的数据?
- c++ - 执行 strcpy 时出现分段错误错误
- jenkins - 无法使用 Web Sphere Deployement(EAR 路径)确定参数化 Jenkins 作业中的参数值
- android - 为什么从存储中选择文件时显示为空?
- swift - 域谓词与对象内的对象
- java - 为 wsdl 生成客户端代码,其中包含更多部分
- jquery - JQuery 点击并不总是有效
- python - 用 Python 对每个符号求解方程(字符串)
- ios - ARKIT 根据物理对象改变节点位置