How can I load a JavaScript file from raw.github.com? This code for CSS works perfectly well:
<link rel="stylesheet" type="text/css" href="https://raw.github.com/myusername/myrepo/master/style.css">
But it will not work for JavaScript:
<script src="https://raw.github.com/myusername/myrepo/master/script.js"></script>
You cannot load JavaScript from Github because the content type is not application/javascript
or text/javascript
.
This is done intentionally to prevent you from using Github as a CDN, which is in violation of their terms of service.
See also: https://rawgithub.com/
And this: https://github.com/blog/1482-heads-up-nosniff-header-support-coming-to-chrome-and-firefox
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With