Including JavaScript files from GitHub into HTML pages

After enabling GitHub pages of your Repository, use following link:

<script src="https://[username].github.io/[repository]/[filename].js"></script>

You will be able to do it with a URL similar to this:

https://rawgit.com/h5bp/html5-boilerplate/master/src/js/plugins.js

Note that this is not the same as clicking on the "raw" button within GitHub; that button will also give you a clean version of the file, but it will be sent with the wrong headers.


A Word of warning; the file is not not being served from GitHub. It is being redirected through the rawgit.com domain. As is stated on https://rawgit.com:

Hey! rawgit.com is just for fun and is not associated with GitHub in any way.

Keep in mind that the owner of that domain is now in control of the traffic and is able to manipulate it as they see fit.