admin管理员组

文章数量:1426066

I know jsFiddle used to support arbitrary javascript files from GitHub, but not anymore. May be GitHub has changed its mime type of raw files. what are the alternatives when the required js files is not in any cdn (may be its less popular js repo).

I know jsFiddle used to support arbitrary javascript files from GitHub, but not anymore. May be GitHub has changed its mime type of raw files. what are the alternatives when the required js files is not in any cdn (may be its less popular js repo).

Share Improve this question edited Oct 5, 2013 at 20:45 Dhana Krishnasamy asked Oct 3, 2013 at 11:52 Dhana KrishnasamyDhana Krishnasamy 2,17618 silver badges36 bronze badges 1
  • That citations doesn't make your question better, this is actually exactly the type of question you should not ask. Better ask "How can i include javascript libraries from arbitrary github repositories without hosting them myself when fiddling around" – Bergi Commented Oct 5, 2013 at 18:41
Add a ment  | 

1 Answer 1

Reset to default 9

It's an old question I see, but still I've found the answer:

  1. Get the Raw URL of the Github file you need to include. e.g. you will have https://raw.github./k4r573n/leaflet-control-osm-geocoder/master/Control.OSMGeocoder.css
  2. Remove the dot (.) between "raw" and "github" and use that resulting url in the jsfiddle. e.g. you will end up having https://rawgithub./k4r573n/leaflet-control-osm-geocoder/master/Control.OSMGeocoder.css that works just perfect in jsfiddle.

Why this works? because of the rawgithub. service that serves the content with the correct MIME type.

And obviously, credits to http://www.geekdave./2013/06/19/linking-raw-github-files-from-jsfiddle/ where I actually found the answer I needed.

Cheers!

本文标签: How do I add arbitrary javascript files from GitHub in jsFiddleStack Overflow