最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

jquery - JSfiddle: What is my fiddle's javascript (*.js) url ? so I can reuse it by src - Stack Overflow

programmeradmin0浏览0评论

What is the url to get and only get this fiddle's javascript code ?

So later on, I may use it for tests by calling it using a <script rel="" src=""></script> link, something like :

<script rel="script" src="/.../.../myFiddleScrip.js"></script>

JSfiddle store versions of our scripts, which my IDE doesn't.


Edit: I'am aware of the /show/ page, my question is is there an independant .js page ?


Edit: As of March 2013, the following patterns works! (pls +1 Danny's answer!)

  • /show_js/
  • /show_css/
  • /show_html/

What is the url to get and only get this fiddle's javascript code ?

So later on, I may use it for tests by calling it using a <script rel="" src=""></script> link, something like :

<script rel="script" src="http://jsfiddle.net/.../.../myFiddleScrip.js"></script>

JSfiddle store versions of our scripts, which my IDE doesn't.


Edit: I'am aware of the /show/ page, my question is is there an independant .js page ?


Edit: As of March 2013, the following patterns works! (pls +1 Danny's answer!)

  • http://jsfiddle.net/username/c0dE5/dd/show_js/
  • http://jsfiddle.net/hugolpz/QUTcW/37/show_css/
  • http://jsfiddle.net/hugolpz/QUTcW/37/show_html/
Share Improve this question edited Mar 27, 2013 at 19:24 Hugolpz asked Mar 27, 2013 at 17:04 HugolpzHugolpz 18.3k28 gold badges105 silver badges191 bronze badges 7
  • ^^ @user1479606 .. I could see how this would be very handy during development --> IE you create the Fiddle, make sure it works, and "test it" on your server's environment without having to upload. ... Although I think the script for Fiddle is inline ... ++ For the idea though .. – Zak Commented Mar 27, 2013 at 17:10
  • Exactly. And JSfiddle store versions of your script, which my IDE doesn't. – Hugolpz Commented Mar 27, 2013 at 17:11
  • 1 I think this isn't possible intentionally as it's not meant as a versioned file-host service, so if there were some way to do it cleanly they'd likely disable it on purpose. So it's not recommended to waste time trying, but if you really want to you could try to GET the source, extract the js inside the script tags, and then eval it...but it's probably definately not the recommmended way to do it. I'd strongly suggest looking into file versioning systems and IDE extensions instead, of which there are many free and premium choices. – BrianH Commented Mar 27, 2013 at 17:17
  • Get a local git repo. – Colin DeClue Commented Mar 27, 2013 at 17:55
  • 1 october 2019: options do not work – Danny '365CSI' Engelman Commented Oct 14, 2019 at 11:35
 |  Show 2 more comments

4 Answers 4

Reset to default 9

It looks like you can add it to your page with the following:

<script type="text/javascript" src="http://jsfiddle.net/hugolpz/QUTcW/37/show_js/"></script>

However that url doesn't look to be officially documented and may change. More info here

see this : view-source:http://fiddle.jshell.net/hugolpz/QUTcW/37/show/

They do not create separate .js file , they just put your script in script tags

Edit: new solution by Danny is far easier !


From BrianDHall's comment emerge this heavy direction

  1. To GET the source http://jsfiddle.net/userName/CODE/DD/
  2. get the js panels's content (something like: $('textarea#id_code_js').value() ),
  3. clean it up and use it.

To explore further if you are interested.

If you are fluent in JS, feel free to share a script solving this question. I will valid it.

The following seems to work, too:

<script type="text/javascript" src="./"></script>
发布评论

评论列表(0)

  1. 暂无评论