Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Including js from raw.github.com

I have a github.com demo page that is linking to https://raw.github.com/.../master/.../file.js so that I don't need to always copy the .js file over to the gh-pages branch every time it's changed. This works in every browser except IE which complains:

SEC7112: Script from https://raw.github.com/cwolves/jQuery-iMask/master/dist/jquery-imask-min.js was blocked due to mime type mismatch

This complaint is coming from the fact that the file is transferred with:

X-Content-Type-Options: nosniff Content-Type: text/plain 

which I can't change.

Anyone have any ideas how to accomplish this same thing? Somehow allowing me to link to the file in the master branch without having to always push it to the gh-pages branch?

Actual page: http://cwolves.github.com/jQuery-iMask/

(Minor update -- I changed the gh-pages in this exact instance to include the .js file, so IE is no longer broken, but would still like any feedback :))

like image 515
Nobody Avatar asked Aug 24 '11 18:08

Nobody


People also ask

Can GitHub pages run JavaScript?

GitHub Pages is a static site hosting service that takes HTML, CSS, and JavaScript files straight from a repository on GitHub, optionally runs the files through a build process, and publishes a website.

What does RAW mean in GitHub?

The Raw button, like the name suggests, opens the file in a raw form, meaning that any HTML formatting disappears. This is particularly useful when you want to download a single file.


1 Answers

You can try using https://rawgit.com/ service. Just replace raw.github.com with rawgit.com

UPDATE

The Rawgit service (former Rawgithub) has been shutdown.

RawGit has reached the end of its useful life October 8, 2018

GitHub repositories that served content through RawGit within the last month will continue to be served until at least October of 2019. URLs for other repositories are no longer being served.

If you're currently using RawGit, please stop using it as soon as you can.

like image 119
H Sampat Avatar answered Sep 23 '22 17:09

H Sampat