Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I add arbitrary javascript files from GitHub in jsFiddle?

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).

like image 790
Dhana Krishnasamy Avatar asked Oct 03 '13 11:10

Dhana Krishnasamy


People also ask

How do you save code in JSFiddle?

Step 2: Right click the bottom frame and select View Frame Source. That's it. You got the html code with online JS links, CSS. Just Save it.

How do I use JSFiddle?

Entering and running code JSFiddle has the notion of panels (or tabs if you switch into the tabbed layout), there are 4 panels, 3 where you can enter code, and 1 to see the result. Once you enter code, just hit Run in the top actions bar, and the fourth panel with results will appear.

How do I search JSFiddle?

Easily enter any jsfiddle username, then search/filter in either jsfiddle title or text (or leave empty to just show all), and then shows fiddle results in a table with details and clickable links. Should be useable by anyone without the need to install anything.


1 Answers

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.com/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.com/k4r573n/leaflet-control-osm-geocoder/master/Control.OSMGeocoder.css that works just perfect in jsfiddle.

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

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

Cheers!

like image 133
Tengiz Avatar answered Sep 19 '22 05:09

Tengiz