Refused to execute script



I created a gist on GitHub with some javascript on it and typed this code to add it to my HTML page.

 <script src=""></script>

When I previewed my page, I found this error on the console:

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

I made sure that the gist was public and disabled all cookie blocking. My full workspace is here:

(look inside of “Editor.html”)


This is the link to the Gist page, which is designed to be pretty and to have tools for editing the gist. You cannot import the code using this link, since it is HTML, as the error describes. Use the link that opens when you click the “Raw” button at the top of the gist file. In this case, it’s

EDIT: Also, if this is something you’ll be putting into production or will be used a lot, you’ll want to self-host the script, as GitHub will block you from using that script and may take more severe measures if they notice large amounts of traffic to that file.


I will probably want to do that. But how do I self-host the script?


Based on your code, I’m not exactly sure how you would plan to host your site. Your cheapest and easiest option would probably be GitHub pages, and in that case, you would simple include the Artist.js file in the repository as it is currently (I would highly recommend this method if you haven’t decided on anything yet). If you’re using something like Apache, it will probably be just as easy, just having the JS file in the same folder or in a javascript folder that is accessible at either or, respectively. Self-hosting the JavaScript alongside the rest of your files is usually pretty simple, my point is just that you need to have permission to host it (GitHub pages I believe explicitly provides permissions in the GitHub ToS, but just linking directly to a Gist would be a violation since you’re using GitHub’s bandwidth for your own site, thereby making them pay more for a service that is not optimized for providing content. Good luck!