Search code examples
javascripthtmlcssmime-types

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>

Solution

  • I think the problem is on the server, go and change the "content-type" of the css file to "text/css" and js file to "text/javascript", that should solve the problem