How to pass GET parameters to jsFiddle

青春壹個敷衍的年華 提交于 2019-12-19 06:00:08

问题


How to pass GET parameters to jsFiddle? I tried http://jsfiddle.net/mKwcF/?id=123 but all I get is http://fiddle.jshell.net/mKwcF/show/

My example js is simple on a given link above:

alert(window.location.href);

回答1:


As of October 2014 it is a little more complicated than it used to be:

If your jsfiddle url is: 

http://jsfiddle.net/u7G7n/44

use instead (including some url parameters):

http://fiddle.jshell.net/u7G7n/44/show/light/?lat1=52&lng1=9&lat2=50&lng2=1

AND send the same url (including parameters) as referer. You can use Referer Control as Chrome plugin: https://chrome.google.com/webstore/detail/referer-control/hnkcfpcejkafcihlgbojoidoihckciin

And configure like this:

Now the second link (including parameters) should work.

EDIT: Plugin RefControl works well for Firefox: http://www.stardrifter.org/refcontrol/ Configure with "fiddle.jshell.net" as site, then choose "Forge" (substitute with root address).




回答2:


Actually, the solution is pretty simple and does not involve any Chrome Plugin.

Just access top.location.search when using the domain name fiddle.jshell.net :

Working example : http://fiddle.jshell.net/techp9/hfpx9zh5/1/show/light/?test=1




回答3:


All you need is to add show at the end of the URL and then add query

e.g:

if your URL is

`http://jsfiddle.net/ishaiborovoy/Yx9P899/123/`

then You should reffer to:

`http://jsfiddle.net/ishaiborovoy/Yx9P6/123/show?myFirstParam=1&mySecondParam=2.`

This works for me.




回答4:


I was just trying to figure out the same thing and ran across this in the jsFiddle documentation.

"Note If you want to use a dynamic resource please add a dummy GET variable i.e. http://example.com/dynamically.php?somevar=somevalue&dummy=.css. This will trick jsFiddle to recognize it as CSS resource."



来源:https://stackoverflow.com/questions/16527958/how-to-pass-get-parameters-to-jsfiddle

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!