【发布时间】:2020-07-14 14:59:45
【问题描述】:
我在使用版本控制时导入 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>
【问题讨论】:
-
经过更多挖掘,似乎如果我使用 styles.css 访问 url - 它会在浏览器中显示 css 文件。如果我访问带有 styles.css?v=1.1 的 url,它将下载 css 文件。也许这就是为什么将 mime-type 更改为 application/octet-stream 而不是 text/css
标签: javascript html css mime-types