简体   繁体   中英

Refused to apply style because its MIME type ('application/octet-stream')

I have an issue with importing css and javascript when using versioning. It appears that when I use styles.css and script.js, everything is working fine, but when I use styles.css?v=1.1 or script.js?v=1.1 - i get the below errors.

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.

What can be the reason of this ?!

They are imported like so:

<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>

我认为问题出在服务器上,将 css 文件的"content-type"更改为"text/css" ,将 js 文件更改为"text/javascript" ,应该可以解决问题

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM