1

I am trying to load mustache.js (logic less template language) from CDN as an external file like :

<script src="https://raw.githubusercontent.com/janl/mustache.js/master/mustache.min.js"></script>

But it is giving below problem:

Refused to execute script from 'https://raw.githubusercontent.com/janl/mustache.js/master/mustache.min.js' because its MIME type ('text/plain') is not executable, and strict MIME type checking is enabled.

Please help me. Thanks.

Ramson
  • 229
  • 4
  • 12

1 Answers1

6

The server that you are trying to get the mustache.js file from is configured to serve the file with Content-type: text/plain which, due to security reasons I imagine, browsers will not interpret as Javascript. I am not sure if you needed a particular version of mustache.js, or a link to the newest version. In looking for other CDN's hosting mustache I was able to find the following that worked for me and might work for you depending on your requirements:

<script
src="https://cdnjs.cloudflare.com/ajax/libs/mustache.js/2.1.3/mustache.js"></script>

Edit:

I found that in fact there is a service that serves corrected MIME types on Github. Your link edited for that service is as follows:

<script
src="https://raw.githack.com/janl/mustache.js/master/mustache.min.js"></script>
aaron-prindle
  • 3,077
  • 1
  • 17
  • 15