188

Is there a download function in jsFiddle, so you can download an HTML with the CSS, HTML and JS in one file, so you can run it without jsFiddle for debug purposes?

justGoscha
  • 24,085
  • 15
  • 50
  • 61

18 Answers18

277

Ok I found out:

You have to put /show a after the URL you're working on:
http://jsfiddle.net/<your_fiddle_id>/show/
It is the site that shows the results.

And then when you save it as a file. It is all in one HTML-file.

For example:
http://jsfiddle.net/Ua8Cv/show/
for the site http://jsfiddle.net/Ua8Cv

justGoscha
  • 24,085
  • 15
  • 50
  • 61
  • That's the best current solution. We will have the download implemented in beta, maybe in alpha as well. – zalun Apr 01 '12 at 06:22
  • 1
    Here's the issue page for this feature https://github.com/jsfiddle/jsfiddle-docs-alpha/issues/156 – Larry Battle May 18 '12 at 17:48
  • 5
    In the very own, for example, `http://jsfiddle.net/Ua8Cv`, if you just type the extra `/show` at the address bar and hit enter (followed by the browser show source code shortcut) to get the source. – heltonbiker Sep 30 '12 at 18:32
  • 1
    I can see in the HTML source code of jsfiddle a hidden button in the toolbar `Show JS` . It doesn't do anything, but maybe is coming soon – corbacho Feb 13 '13 at 20:30
  • JSFiddle puts script tags in , which isn't recommended, as far as I know? – Rob Grant Nov 14 '13 at 11:35
  • 4
    In 2015, after going to `/show`, save the complete page, then look into the folder that ends with `_files`, inside should be a `.html` file with the source code of the example. – Castro Roy Apr 01 '15 at 21:12
  • 14
    Crucial step missing. After http://jsfiddle.net/Ua8Cv/show/ select the javascript, choose view frame source, then save. Not just page source. – Eric Bridger Jan 25 '16 at 19:32
  • If you're viewing source make sure you view FRAME source for the /show/ URL – niico Nov 22 '17 at 20:51
  • TTBOMK, I have followed the guidance to the letter: http://fiddle.jshell.net/qodkefat/1/show, ran the fiddle, tested, right click in chrome, view frame source, copied all and pasted into Dreamweaver, saved, f12 to view in browser... no success. Later tried the same with /light added to the address, but this returns 404 error. – secr Jun 11 '20 at 04:30
  • @EricBridger how can I select javascript in /show URL? – Nafeo Alam Jun 26 '20 at 11:08
  • @nafeo You need to first run the fiddle. The right click and choose view source, then save the source. – Eric Bridger Jun 27 '20 at 12:45
96

New answer to an old question:

Method 1:

Step 1: You have to put /show after the URL you are working on:

http://jsfiddle.net/<fiddle_id>/show/ 

It shows the output with a result header.

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.

For Example: http://jsfiddle.net/YRafQ/20/show/ for the site http://jsfiddle.net/YRafQ/20/

Note: View Frame Source and not View Page Source

Method 2:

You can use this code: view-source:http://fiddle.jshell.net/<fiddle_id>/show/light/

For Example: For my fiddle_id: YRafQ/20

view-source:http://fiddle.jshell.net/YRafQ/20/show/light/
Leos Literak
  • 8,805
  • 19
  • 81
  • 156
Pradeep Kumar
  • 4,065
  • 2
  • 33
  • 40
18

Step 1:
Go to a fiddle page like jsfiddle.net/oskar/v5893p61

Step 2:
Add '/show' at the end of the URL, like jsfiddle.net/oskar/v5893p61/show

Step 3:
Right click on the page and click on the View frame source. You will get the HTML code including CSS in tag and Javascript (js) in tag. [Also source link of all library will be added]. See screenshot

Step 4:
Now you can save the source code in a .html file.

johirpro
  • 509
  • 4
  • 16
14

Adding /show does not present a pure source code, it's an embedded working example. To display it without any additional scripts, css and html, use:

http://fiddle.jshell.net/<fiddle id>/show/light/

An example: http://fiddle.jshell.net/Ua8Cv/show/light/

Suprido
  • 525
  • 7
  • 17
  • Have you seen that? What is the `Result` in the header? – Little Alien Jul 19 '16 at 14:24
  • 1
    Perhaps this once worked, but in 2018, navigating to such a URL without a "fiddle.jshell.net" HTTP referer header gives it embedded in an iframe, same as http://jsfiddle.net//show/ or http://jsfiddle.net//embedded/result/ – Jacob C. Feb 27 '18 at 23:15
  • 3
    Perhaps that once works, but in 2020, it gives a 404 page. Yikes. – corn on the cob Oct 17 '20 at 07:55
13

No, JSFiddle doesn't have a download feature. However, it's not very difficult to get around that and save the contents of a fiddle anyway.

Since the time the accepted answer was posted, JSFiddle has made some recent UI and backend changes that affect the way a fiddle should be downloaded. Note the updated procedures below.


Simple Commandline Method

This method only downloads the fiddle's HTML, JavaScript, and CSS as a single file. The fiddle's external resources are not saved.

In the commandline shown below, fiddle_id refers to the ID number of the fiddle. For a fiddle with the URL "http://jsfiddle.net/<fiddle_user>/<fiddle_id>" or "http://jsfiddle.net/<fiddle_id>", only the fiddle_id is needed. The fiddle_user is unimportant.

At a shell prompt, enter the single commandline:

fiddleId=fiddle_id; curl "http://fiddle.jshell.net/${fiddleId}/show/" -H "Referer: http://fiddle.jshell.net/${fiddleId}/" --output "${fiddleId}.html"

The fiddle will be saved to a file named "fiddle_id.html".


Longer Browser Method

This method downloads the fiddle as well as its external resources. The steps given are based on using Google Chrome. Using other web browsers should work as well, but they may use different filenames.

  1. Select the "Share/Embed" menu/link at the top of the JSFiddle edit page. In the dialog box that appears, copy the URL shown in the "Share full screen result" field. It will be of the form "http://jsfiddle.net/<fiddle_user>/<fiddle_id>/embedded/result/" or "http://jsfiddle.net/<fiddle_id>/embedded/result/".
  2. Open a new browser window and paste in the URL copied in the previous step. Load that page.
  3. Use your browser's save feature to save the page and all of its resources to your local computer. To save all the resources using Google Chrome, for example, be sure to select "Webpage, Complete" in the "Format" menu. Be sure to specify a name for the page. Let's say it's named "fiddle.html" for this example.
  4. After the page is saved to your computer, you will have the "fiddle.html" file and a directory named "fiddle_files". The file "fiddle.html" is the wrapper page that JSFiddle uses to display a header with a "Result" title and other links. It will load your fiddle in an iframe element. For the most part, this file can be ignored or even deleted. Your fiddle's HTML, JavaScript, and CSS content will all be saved in the "fiddle_files" directory as a single file named "saved_resource.html".
  5. Copy "fiddle_files/saved_resource.html" to wherever you'd like to use it. If your fiddle included items under "External Resources", those will also appear in the "fiddle_files" directory. Be sure to copy those files to the same place to which you copied "saved_resource.html", because the HTML file will refer to those resources using relative URLs.

As mentioned earlier, other browsers may name the files differently when they are saved. For example, Firefox names the combined HTML/JS/CSS file "fiddle_files/a.html".

Mr. Lance E Sloan
  • 3,297
  • 5
  • 35
  • 50
7

Still no download functionality supported.. BUT.. you can use the jsfiddle-downloader node script.

Installation:

npm install jsfiddle-downloader -g

To download a single fiddle from its id:

jsfiddle-downloader -i <fiddle-id> [-o <output file>]

To download a single fiddle from its url:

jsfiddle-downloader -l <url> [-o <output file>]
jsfiddle-downloader -l jsfiddle.net/<user>/<fiddle-id>
jsfiddle-downloader -l https://jsfiddle.net/<fiddle-id>
jsfiddle-downloader -l https://jsfiddle.net/<user>/<fiddle-id>/show/ -o myfiddle.html

To download all scripts of a determinated 'user' from jsFiddle.net:

jsfiddle-downloader -u <user> [-o <output file>]

It'll download all backups in the currrent directory, the jsFiddles scripts will be named as:

[<output-folder>/]<id-fiddle>.html
Facundo Victor
  • 3,308
  • 1
  • 25
  • 20
5

The best way is:

  1. Right-click on the output panel.
  2. Choose view frame source, then the whole code will appear.

After that you can copy that code, and paste it in your computer.

ASammour
  • 865
  • 9
  • 12
2

You have to put /show a after the URL you're working on:

For example:

"http://jsfiddle.net/rkw79/PagTJ/show/"

for Field URL :

"http://jsfiddle.net/rkw79/PagTJ/"

after that save the file and go to the show folder(or the file name you have saved with) under that folder u will get a html file show_resource.HTML .that is your actual file.now open it in browser and view the source code. Best of luck--------Ujjwal Gupta

Ujjwal Kumar Gupta
  • 2,308
  • 1
  • 21
  • 32
  • Please stop answering questions that have been solved over 2 years ago with a high upvoted answer. This provides no benefit to anyone. – rayryeng Dec 25 '14 at 19:24
2

In a recent work I had to download a list of fiddle urls and create separate folder for each fiddles having separate html css js file for each, i have created the following crawler program for this. https://github.com/sguha-work/FiddleCrawler .It will create folder name with counter value and each folder will have a html, a css, a js and a details file. (The details file will holds the links of external resources).

Sahasrangshu Guha
  • 672
  • 2
  • 11
  • 29
2

I found an article under the above topic.There by I could take the full code .I will mention it.

Here are steps mentioned in the article:

  1. Add embedded/result/ at the end of the JSFiddle URL you wanna grab.

  2. Show the frame or the frame’s source code: right-click anywhere in the page and view the frame in a new tab or the source right-away (requires Firefox).

  3. Finally, save the page in your preferred format (MHT, HTML, TXT, etc.) and voilà!

also you can find it : https://sirusdark.wordpress.com/2014/04/10/how-to-save-and-download-jsfiddle-code/

casper
  • 449
  • 7
  • 20
1

You can download using this package in node js,

https://www.npmjs.com/package/jsfiddle-downloader

MegaCha05
  • 11
  • 3
1

There is not such a proper way to download all the things all together from JSFiddle but there is a hack way to do just that. Simply add "embedded/" or "embedded/result/" at the end of your JSFiddle URL!, and then you can save the whole page as an HTML file + the external libraries (if you wants).

0

If you want to download all of your fiddles to an offline folder, there is a script available for this:

https://github.com/isonno/DownloadJSF

J. Peterson
  • 1,996
  • 1
  • 24
  • 21
0

Try copying and pasting your code into WebDen and then downloading it from there. Only drawback is that it only supports pure JS, html, and css, so any other code may need to be downloaded another way.

-1

Okay, the easiest way, I found out was just changing the url (jsfiddle[dot]net) to fiddle[dot]jshell[dot]net/ There u have a clear html code, without any kind of iframe... Example: https://jsfiddle[dot]net/mfvmoy64/27/show/light/ -> http://fiddle[dot]jshell[dot]net/mfvmoy64/27/show/light/

(Must change the '.''s to "[dot]" because of stackeroverflow... :c) PS: sry 4 bad english

lo1c
  • 1
-1

There is npm-package jsfiddle-downloader.

alxaux
  • 39
  • 4
-2

Use http://jsfiddle.net//show/light/

then just use inspect element function of browser. you will get code in iframe tab. . in chrome just right click and cick on edit as html tab. and copy the html content. that is your actual code.

-4

Ctrl + S, saves the entire fiddle, inside the files folder there is the clean page you are looking for

Abhishek
  • 6,912
  • 14
  • 59
  • 85