Loading ...

Using JavaScript file hosted on github: Refused to execute script from 'xxx' because its MIME type ('text/plain') is not executable, and strict MIME type checking is e | CodeAsp.Net

Using JavaScript file hosted on github: Refused to execute script from 'xxx' because its MIME type ('text/plain') is not executable, and strict MIME type checking is enabled.

 /5
0 (0votes)

For sample purpose I was using the js references directly from Github i.e I was using this:

 <script  type="text/javascript"  src="https://raw.github.com/WickyNilliams/headroom.js/master/src/jQuery.headroom.js"></script>
    <script type="text/javascript">

And after running the page having the above reference I was getting this:

Refused to execute script from 'xxx' because its MIME type ('text/plain') is not executable, and strict MIME type checking is enabled

The reason was that GitHub has explicitly disabled JavaScript hotlinking for that "raw.github.com" domain. The solution was to use "rawgithub.com" domain. The solution was to use this reference instead:

 <script  type="text/javascript"  src="https://rawgithub.com/WickyNilliams/headroom.js/master/src/jQuery.headroom.js"></script>
    <script type="text/javascript">

Comments (no comments yet)

Top Posts