103

It's extremely common for people to ask and answer questions with no code other than a link to http://jsfiddle.net or similar service. These of course are not appropriate. I have personally been unable to access jsfiddle for hours due to the site being down while browsing Stack Overflow.

In an effort to help educate people on why this is a bad idea and at the same time improve posts on SO, I suggest some measures be put in place to prevent it from happening.

For example, if the question or answer has:

...prevent it from being posted, with a message or link explaining why. There may be edge cases where it does make sense, so perhaps we'd need to allow the user to click through the message and post anyways, but at least they will have been warned/educated.

If we need to discuss whether or not "link only, no code" posts are problematic and not appropriate, then so be it - but I think it's obvious and that topic has been well covered. Is there anything we can do to prevent them and encourage people to put their code in their post?

This issue is very specific to jsfiddle, I would like to see something that directly addresses that. If another site becomes the defacto code demo site, then we can cross that bridge when we get to it or look for more general solutions to this ever growing problem. I think that awareness of the issue is key to preventing it, and people don't read the FAQ nearly enough as it is - we need some direct intervention.

According to the owner/creator of jsfiddle, Stack Overflow makes up 30% of all referrals. That's a huge amount. Sure they aren't all "link only" posts, but I want to emphasize how much SO is using jsfiddle in particular to dump their code.

People aren't doing this to harm the site, the usually think they are helping out by making their post easier to read. They need to understand why this is actually a problem, and why relevant code must be posted on the site, not somewhere else. If more people understood, I think the problem would start to go away on it's own - but we'd still need something to deal with newer users who aren't familiar with the rules and goals of SO and Stack Exchange, don't hang out in meta, don't read the FAQ, etc. However, the less examples of jsfiddle-link-only posts there are, the less people will imitate them.

I honestly think that if people understood the problem more, it wouldn't be as much of an issue. This doesn't mean blocking jsfiddle, but preventing posts that rely on links to it. A lot of people are confused about that, and ask me "Since when is jsfiddle not allowed?". It's allowed, but your post should hold up without the link. People need to understand that - a warning message would probably be enough.

I do not feel that this specific issue is "status-completed". I think it's still a major problem that's bound to get worse as the months and years go by.

Here are some examples from the past few hours, as of 2012/10/17 6:45 PM EST:

Here are some more from this morning, 7:30 AM 2012/10/18 (all questions, all within the last couple of hours). I could have easily found a lot more but it was getting boring:

These were ridiculously easy to find (took me about 3-4 minutes). I don't think the recent change has done very much to help the situatuion. There are literally entire threads on SO that are just passing jsfiddle links back and forth, and it's been like that for a long time - and bound to continue unless something is done to address this specific issue.

20
  • 5
    I'd go so far as to say we should ban jsfiddle links from questions/answers and restrict them to comments, explicitly relegating them to a supporting role rather than being the primary means of including code in a question, but I suspect support for an out-right ban will be pretty small.
    – user229044
    Commented Oct 9, 2012 at 17:03
  • 15
    Yeah a ban would not help IMO, those services are extremely useful and often used to display much more code than is necessary in the question or answer. I'm seeing entire threads on SO that are just jsfiddle links and it's ridiculous, especially when it's only a few lines of code.
    – user159834
    Commented Oct 9, 2012 at 17:07
  • 4
    If we need to discuss whether or not "link only, no code" posts are problematic and not appropriate There's no need as its been discussed before Commented Oct 9, 2012 at 17:07
  • @SomeHelpfulCommenter: Yeah there are tons of posts on meta about that as well as comment threads on SO, but I try to be careful making assumptions when posting here. Surely you know as well, a lot of people are clueless about the issue.
    – user159834
    Commented Oct 9, 2012 at 17:08
  • 27
    How about instead of fighting each other, we work together and incorporate some usage of jsFiddle into SO. I'm open to suggestions. Oskar of jsFiddle. Commented Oct 10, 2012 at 10:16
  • 1
    @OskarKrawczyk: That's pretty much the ultimate solution, and it's been suggested before that we have our own code sandbox, or some integration with jsfiddle. Do you have any stats on how much of your traffic comes from Stack Overflow?
    – user159834
    Commented Oct 10, 2012 at 17:15
  • If you're motivated to do this, you should definitely raise a discussion here about it or perhaps even just email [email protected]. And of course, thanks for what your invaluable work @Oskar.
    – user159834
    Commented Oct 10, 2012 at 17:21
  • I agree on preventing answers, but not questions (as there are cases where this will be a problem)
    – ajax333221
    Commented Oct 10, 2012 at 18:28
  • 1
    @ajax333221: I don't see a single good example there, and most of those 207 questions shouldn't even have the tag "jsfiddle" because they aren't about jsfiddle.
    – user159834
    Commented Oct 10, 2012 at 19:03
  • 2
    Just to clarify: This doesn't mean blocking jsfiddle, but blocking posts that are just links. A lot of people are confused about that, and ask me "Since when is jsfiddle not allowed?". Also, opponents to this idea: please speak up. If there are concerns they need to be heard and discussed.
    – user159834
    Commented Oct 15, 2012 at 17:11
  • 1
    You're making me want to delete all the answers there :| Commented Oct 18, 2012 at 16:37
  • 2
    What about jsfiddle links masked in tinyurl or some other redirecting sites? It usually takes about 5 to 10 seconds generating a redirect link from these sites.
    – TtT23
    Commented Jun 18, 2013 at 14:47
  • 1
    I get what you are saying, but in editing I have come across several posts that had quite a bit of description of what is going on along with a jsfiddle link. The jsfiddle link should not invalidate the post. If the jsfiddle link is that star of the post, yes horrible post that doesn't belong on SO. If it is an accessory to the post, this rule makes no sense. You are throwing out the baby with the bathwater
    – demongolem
    Commented Aug 18, 2013 at 5:18
  • 1
    @demongolem I have a lot of doubt that those posts should not include code as well. The fact that there is a jsfiddle link means there is some code that is relevant to the question.
    – user159834
    Commented Aug 18, 2013 at 20:06
  • 1
    I can't upvote this enough.
    – Steven
    Commented Jun 6, 2019 at 23:53

9 Answers 9

64
+1000

The code's been checked in, and will go out in the next build is now active on all (non-meta) sites.

What code you ask? Well, we talked this over and decided the problem isn't really jsfiddle it's just super short posts that contain links as the bulk of their content*. Put another way, there are alternatives to jsfiddle that will come to be used in just the same way; so singling out jsfiddle doesn't buy us much.

Instead, we've changed the minimum body length check to not count anything in the form of a link (doesn't matter to what or whether they're even actually anchors when rendered). We'll be keeping an eye on things to see if the minimum length needs to be raised (it's currently at 30, which I think is a little short personally).


So, after watching this for a day and looking at what's getting posted... this wasn't enough. While the length limit helps a bit (and closes some other holes in validation around link-only posts), there were still a number of posts that really should have had code (but didn't) getting posted.

Since we couldn't find a reasonable character limit that looked like it would catch most of the offenders (we had a number of examples > 300 characters within 24 hours), we have started special casing jsfiddle and ideone links.

So, from now on, if you try and post to Stack Overflow with a link to either jsfiddle.net or ideone.com you'll be required to include some properly formatted code as well. We do special case direct links to their home pages, so you can still mention http://jsfiddle.net/.

To be clear, links to jsfiddle and similar services are OK but a question or answer should stand on its own. Enough information should be included in any post to still make it useful for future visitors even if all the links were to break, in other words.

*We've always felt that answers should be able to stand alone, without any external links.

39
  • 5
    I have major doubts this will solve the specific issue raised, but I am looking forward to this nonetheless. I will certainly be keeping an eye out. When will the next build be released, approximately?
    – user159834
    Commented Oct 16, 2012 at 23:41
  • @Welsey - An hour or so I'd guess. Commented Oct 16, 2012 at 23:42
  • Fantastic, thanks for the info. I'll add links to problem posts that get by this requirement as I see them (so concrete examples can be examined) - I expect there will still be many but not as many. Often the "fiddle" posts (questions especially) will easily pass 30 characters of non-link content.
    – user159834
    Commented Oct 16, 2012 at 23:43
  • 3
    Agreed. I'm not sure this will actually fix the problem. I've often seen (and can probably dig up) questions with paragraphs of text and a link to code. Commented Oct 17, 2012 at 2:35
  • I agree 30 may be pretty low, "Here is the solution to your problem" is 36 characters for instance.
    – Dreen
    Commented Oct 17, 2012 at 17:20
  • @csh That's a completely unrelated point Commented Oct 17, 2012 at 17:21
  • @MichaelMrozek people post on jsfiddle because they feel it's more comfortable for the reader
    – c s h
    Commented Oct 17, 2012 at 17:24
  • Cool, I was hoping you'd put in a fix for something like this rather than booting jsFiddle in particular
    – Zelda
    Commented Oct 17, 2012 at 20:03
  • 1
    This solution is definitely not working.
    – user159834
    Commented Oct 17, 2012 at 22:58
  • 2
    I'm sure there'll be some blowback on meta about the new fix, but this is going to be huge for SO if it works, really looking forward to seeing it. You guys are awesome, thanks for addressing this. Questions though: will the lack of code blocks prevent the post completely or just show a warning? I kind of want to try it out...
    – user159834
    Commented Oct 18, 2012 at 22:36
  • 1
    Hahaha it's working! stackoverflow.com/questions/12971440/… I only found a couple cases that were sketchy like this one, but man, wow, this is amazing. People are working around the issue by... posting their code! Huge success, I'm very impressed. Thanks for handling this guys! It could maybe stand to be improved, like with a minimum length of formatted code, but people are getting the hint and it looks like posts have improved drastically.
    – user159834
    Commented Oct 19, 2012 at 12:08
  • 3
    @ShaWizDowArd: today I learned that proper C++ is indistinguishable from a URL.
    – user7116
    Commented Oct 29, 2012 at 16:27
  • 1
    Today I wanted to post an ideone link as part of an answer, showing that the code already in the question works, but the system wouldn't let me. Fortunately I could still add the link in a comment. I normally use ideone as proof of working, not as a pastebin. I understand in most cases the restriction makes sense, so I'll just live with it.
    – Jester
    Commented Nov 27, 2012 at 23:39
  • 2
    @KevinMontrose: Long enough posts should be excluded from this ban. Also, it would be good if people editing existing posts didn't get caught up with not being able to submit their edit, but that should go for most bans, so please bare that in mind. It's annoying when all I tried to do was improve a post, only to hit this ban. See this post. Commented Dec 12, 2012 at 23:20
  • 2
    agree with @mellamokbtheWise. Here's another example of mine where the solution had nothing to do with the code, but rather the image that that OP was using. I had to modify the fiddle (and OP's original code) because of a bug in Chrome. Re-posting code in my answer is confusing to users, because the answer is not in the code, it's in the image itself.
    – Jeff
    Commented Apr 7, 2013 at 23:04
22

Absolutely a good idea, if somewhat tricky to implement.

It is the current policy of Stack Overflow that questions cannot depend on external links to be meaningful or answerable, and we are doing nothing to enforce this.

People are constantly posting questions which contain a description of the problem and a link to a jsfiddle. What's worse, people provide them with answers that contain nothing but a jsfiddle and entire question becomes a series of revisions to a jsfiddle. Utterly useless, and not at all how Stack Overflow is supposed to work. I would love to see some strong deterrent to this flow.

I think that stopping posts which contain a jsfiddle link but no code blocks is a great idea, and has a pleasant side-effect of forcing people to format their code with indents inorder to make the site recognize it.

4
  • Maybe there are other solutions to this issue, that involve education rather than auto-prevention, or the current system: downvotes, arguments, long comment threads, and manual editing?
    – user159834
    Commented Oct 10, 2012 at 17:25
  • 3
    @WesleyMurch Yes, because the current system of "arguments, long comment threads and manual editing" sounds so appealing. Prevention would be the ideal solution. I'm tired of seeing questions full of nothing but useless jsfiddle links, and more tired still of seeing these questions rewarded with upvotes and answers. Users are constantly encouraged to continue this bad behaviour by other users who don't know enough to downvote them and withhold answers to bad questions.
    – user229044
    Commented Oct 10, 2012 at 17:36
  • 1
    IMO a much worse problem is a link to their own site, at least the JS Fiddle is, by definition, an SSCCE.
    – Zelda
    Commented Oct 15, 2012 at 12:12
  • @BenBrocka: It's worse but not nearly as common, and only happens on questions - people answer with Try this: [jsfiddle link] all the time.
    – user159834
    Commented Oct 15, 2012 at 14:11
13

It's fairly easy to get the code from jsFiddle. If someone would enter a jsfiddle link system could pull css, html and js code (show_css/ show_html/ and show_js/, in ex. http://jsfiddle.net/zalun/8nC4x/show_js/)

Instead of making life more complicated SO would simplify entering code.

6
  • Very cool, doesn't address pastie or ideone etc., but of course jsfiddle is probably the only relevant one. This is a rad idea, I'd love to see it implemented but it's still prone to service outages from jsfiddle when the post is entered and does nothing to address the understanding of the plz-show-ur-code problem, most likely will make it worse - people relying on jsfiddle just to post on SO.
    – user159834
    Commented Oct 10, 2012 at 20:45
  • Thread is about jsFIddle only. The code would be pulled from jsFiddle while entering the question. It becomes written into StackOverflow database
    – zalun
    Commented Oct 11, 2012 at 14:44
  • 1
    Right, it's a great idea. Do you have any stats on how much of your traffic comes from Stack Overflow?
    – user159834
    Commented Oct 11, 2012 at 15:37
  • 3
    it is about 30% of all referrals
    – zalun
    Commented Oct 11, 2012 at 21:12
  • 3
    We don't want to make it any easier for people to dump crappy code-only questions into the site. If you can't be bothered to read the rules and learn how to post proper questions, we don't want your questions here. Stack Overflow lives or dies by its signal-to-noise ratio, and this actively hurts us.
    – user229044
    Commented Oct 15, 2012 at 15:46
  • I second that. Every good programmer knows that duplicated code takes us to problems - even if it is duplicated on stackoveflow and jsfiddle.
    – fotanus
    Commented May 13, 2014 at 22:48
10

Instead of preventing posts with links to JSFiddle and no code, I believe a better approach should be encouraged.

For example, question with the following format can be considered very good.

I can't get the ready on this function execute

$(document).ready(function() {
   console.log('I am ready');
});

Fiddle showing the Issue

But to enforce such pattern would worsen many other good patterns too. But instead we could eliminate the need of systems like JSFiddle at all.

As for suggestions:

Some of us, use some patterns to annotate the type of coding in the answer like <!-- language: lang-js -->, so may be we can use these and create an Sandbox to show the issue ourselves and not rely on jsfiddle or similar. Let me try to explain this in reference to above example

To take inputs like this:

<!-- language: lang-js -->

$(document).ready(function() {
    console.log('I am ready');
});

And give a option to run it

$(document).ready(function() {
   console.log('I am ready');
});

Such button can then trigger a popup or iframe running the code.

12
  • 1
    Sorry can't see your point. Care to clarify? Commented Oct 15, 2012 at 9:34
  • 1
    Are you suggesting to allow anyone to run code on Stack Overflow? That's a bad suggestion: One could add for(;;); to annoy others.
    – Rob W
    Commented Oct 15, 2012 at 9:41
  • 1
    @RobW, No, One could click a button like show issue and then see the issue, same thing can happen with for(;;); in a fiddle too.
    – Starx
    Commented Oct 15, 2012 at 11:12
  • @Starx Opt-in is better. But you still have the issue with replacing the parent (main) frame with some obscure site.
    – Rob W
    Commented Oct 15, 2012 at 11:14
  • @RobW, I have tried to add an example to understand better.
    – Starx
    Commented Oct 15, 2012 at 11:19
  • @Starx I see. Your main suggestion's is not having the "sandbox" or "live (inline) demo", but having the code hosted on a host which is managed by the Stack Exchange, right?
    – Rob W
    Commented Oct 15, 2012 at 13:45
  • 2
    The idea of SO having their own code sandbox has been brought up before and I think is a fantastic idea (also jsfiddle is limited to CSS HTML and JS). I don't know that it would solve this particular problem, as in your examples the code is already in the post, and also the poster may be using psuedo code or classes/functions/variables that are not defined so the code won't actually run. I think links to demos are fine, they just shouldn't be the only content in an answer. Besides, many of us just need one glance at the code to see if it is valid, there's no need for a demo at all.
    – user159834
    Commented Oct 15, 2012 at 15:00
  • @RobW, Yes this way we can then block the jsfiddle and ensure that question asker will input his code in the question.
    – Starx
    Commented Oct 15, 2012 at 16:30
  • You've invented Stack Snippets. Well done.
    – wizzwizz4
    Commented Jul 31, 2016 at 17:18
  • 1
    @wizzwizz4, Did I? For real? I had no idea.
    – Starx
    Commented Aug 8, 2016 at 10:07
  • 1
    @Starx If not the first, you were definitely one of the first people to suggest this, and what you have written here is very similar to the current implementation.
    – wizzwizz4
    Commented Aug 8, 2016 at 14:38
  • @wizzwizz4, :) Thanks. Much obliged
    – Starx
    Commented Aug 8, 2016 at 16:07
7

Would it not be better to incorporate the feature set of what jsFiddle has to offer, after all, there is a reason why people are using it.

I personally can't stand the limited text view of posting code into a forum, particularly if im trying to describe a visual problem, I need people to see the problem for them to be able to help, now they have to copy and paste all my code into an editor just for them to see it, instead of clicking a link.

7
  • Totally agree, It is nearly impossible to add code that is more than 5 lines long in stackoverflow. It is bloody dumb to disallow jsfiddle. These idiots really do not understand how useful jsfiddle is for most users. Commented Oct 30, 2012 at 14:45
  • 2
    @specialscope: jsfiddle is not being disallowed; you just have to also include your code in your post. Cutting and pasting code from jsfiddle is not difficult at all.
    – user102937
    Commented Oct 30, 2012 at 15:19
  • 1
    @specialscope The only issue I have with entering code is not being able to tab, and that's fixed easily by using any text editor you like to gather your code before adding it to the question/answer. To clarify: Nobody is saying you can't use jsFiddle, only that you can't just use jsFiddle. Questions that rely on the content of the jsFiddle are useless the moment that link dies, and StackOverflow is all about questions being useful to more than just the person that asked them. Commented Oct 30, 2012 at 15:38
  • 1
    @Robert Harvey it does not make sense to cut a part of code from jsfiddle and paste in stackoverflow because it wont necessarily explain the answer. If the user has to go to jsfiddle anyway why do that. I agree that in the question part there should be some sort of explanation and not just jsfiddle but regarding answers I just do not agree. Just look at your limitations 300 words! There has to be some middle ground. This is plain dictatorship. Commented Oct 30, 2012 at 16:06
  • 4
    @specialscope: If you can't get the code to fit in the post, it's too long to be evaluated by the community anyway. See sscce.org and en.wikipedia.org/wiki/Dictatorship
    – user102937
    Commented Oct 30, 2012 at 16:08
  • Look I love stackoverflow to bits but I feel greater voice is not being heard. Most of folks in meta are quite accomplished at what they do so they might not need too much help from stackoverflow but for the rest of the folks we need it. And we need it to be able to solve problems at our hand. Dont take that away. Besides stackoveflow has pretty good crap filtering system (negative voting) Commented Oct 30, 2012 at 16:11
  • There are IMO a number of improvements that could benefit SO. One of these is a better code editor - currently I for one use external software to cope with tabbing and then paste the code after indenting it into the SO question/answer editor, which makes it properly formatted (and with tabs in all the right places!). But I think it could entirely be possible to incorporate some basic functionality in inline editor. Plus, I am all for runtime code evaluation ala JSFiddle, time and energy permitting. Commented Jun 14, 2013 at 12:42
4

The minimum-text body length does not even come close to fixing the issue. Here are some recent examples:

(PS: This is an editing field day, please help out by adding the code to the questions themselves if you have a moment)

These 20 examples took me a matter of minutes to find, and they've all been asked after 10-17-2012, when the "fix" should have been in place.

Keep an eye on these search results. The majority of them exhibit the link-to-code-only problem.

The accepted answer is not an acceptable solution. This needs to be addressed more aggresively.


Proposed solution:

Okay I know this isn't perfect but maybe it'll give someone else an idea.

How about simply not allowing users to post questions that include a link to a specified set of code-hosting sites (JSFiddle, IDEOne, etc.) and do not include any code? Is there ever a chance that a link to one of those sites and no code is actually a valid question? I don't think so. Wouldn't this be relatively easy to implement?

Updated per comments below:

In addition, we should tell users why they can't ask a question that isn't meeting our quality standards. We could display a message and link to a useful meta Q&A or an item in the FAQ.

15
  • Were those asked in the last 15 hours? That's when the change was deployed per Kevin. Commented Oct 17, 2012 at 17:07
  • 2
    @JeffAtwood Yep, they were. "These 20 examples took me a matter of minutes to find, and they've all been asked after 10-17-2012, when the "fix" should have been in place." The questions all have >30 chars of non-link text, but they still couldn't be answered if the jsfiddle link was dead.
    – Servy
    Commented Oct 17, 2012 at 17:08
  • I see many of them were. Remember this change is about preventing the most egregious examples of links without sufficient explanation; there is no rational way it could catch them all. that said as Kevin indicated 30 chars with a link might not be high enough. Commented Oct 17, 2012 at 17:09
  • In other words this is a first line of defense. What do you propose as the next line of defense? Commented Oct 17, 2012 at 17:10
  • @JeffAtwood this seems to be the worst of the examples I've come across so far. 32 chars of non-link text.
    – Servy
    Commented Oct 17, 2012 at 17:11
  • I have an idea, I was in the middle of editing the answer. Please hold... Commented Oct 17, 2012 at 17:11
  • As for a solution, the ideal would be for the community (in the javascript/jquery/etc. tags) to just not accept these kinds of answers. If everyone posts comments demanding code to be in the answer/question itself, and don't upvote (or actually downvote) content that violate the principle then all will be okay. Clearly that's not happening (much) right now though.
    – Servy
    Commented Oct 17, 2012 at 17:13
  • @JeffAtwood: I don't even think it's a good first line of defense. I'm not convinced there's more than a weak correlation between short questions and questions containing just links. Commented Oct 17, 2012 at 17:19
  • I don't agree, I believe in a defense in depth strategy with multiple lines of defense -- that said I really like your suggestion a lot. Commented Oct 17, 2012 at 17:24
  • @JeffAtwood: I see your point. In other words, there's no harm in keeping around the solution that was implemented right now. It probably has helped somewhat. Commented Oct 17, 2012 at 17:45
  • 1
    The thing is that most users just don't get it! If we could warn them with a message if there are no code blocks: "Your post appears to rely on an external link.." and have that message link to the reason why it's not cool, that would persuade/educate most users. They are usually happy to include the code but don't want to because they think it's "too much" or just not necessary - they don't understand the problem. For example: stackoverflow.com/questions/12939086/…
    – user159834
    Commented Oct 17, 2012 at 18:06
  • @WesleyMurch: I can buy that--so I would modify my proposed solution to disallow such questions but explain why to the user and direct them to a meta discussion explaining why it's necessary to include code in the question. Commented Oct 17, 2012 at 19:20
  • Having people be aware of the problem is the goal. The rest will pretty much fall in to place after that. I've never had someone disagree when I post comments like "please post your code because blah blah blah" (which I'm sick of doing, also sick of editing). And the more people realize this, the more they will stop doing it, and the less examples of it there will be for other users to emulate. I don't believe anyone is posting link-only content because they want the site to suck, they think they are helping and doing something good, making it easier for people to help them (or help others).
    – user159834
    Commented Oct 17, 2012 at 19:54
  • I want your answer at the top so I'm accepting it, this is clearly a major problem and the solution did not help nearly enough, if at all. Let's be realistic, the problem here is specifically with jsfiddle link-only posts that have no code. It's going to be a bad scene if this continues into the coming years.
    – user159834
    Commented Oct 17, 2012 at 19:56
  • One solution is you Low Quality ban the users upon detection of link-only posts and give them a chance to edit their posts. Put their edits into the review queue (nb: this presumes the edit queues work...) and force them to wait on people to say they've made enough effort.
    – user7116
    Commented Oct 17, 2012 at 20:13
1

Here's a query to help find those kinds of posts:

https://data.stackexchange.com/stackoverflow/query/374895/find-question-in-the-past-month-that-have-links-to-jsfiddle-or-codepen-but-no-cod

select concat('http://stackoverflow.com/questions/',Id) as 'Link', Score
from Posts where CreationDate > DATEADD(MONTH, -1, GETDATE()) and PostTypeId = 1
and (Body like '%jsfiddle.net%' or Body like '%codepen.io%')
and not (Body like '%    %' or Body like '%<pre>%' or Body like '%<code>%')

It finds all posts in the last month that contain "jsfiddle.net" or "codepen.io" in the body, but don't have one of these three code markers: `, <code>, or four spaces

It won't catch all of them, but it's mostly free of false positives.

1
0

I think there's a better method to address the perceived concerns of this page.

The concerns appear to be that when people use links to JSFiddle it's bad because:

  • Sometimes JSFiddle is down.
  • Stack Overflow gets too many outbound links. I'm not sure what the negative part of this is, but I will assume it's that SO loses search rankings and "link juice". Quoting from above, "According to the owner/creator of jsfiddle, Stack Overflow makes up 30% of all referrals. That's a huge amount."

I don't think the answer to either of these two concerns is to clone JSFiddle's content.

In terms of the first concern, I will present a better solution below. But I'd like to preface this by saying that links which change are just the nature of the web. This is no different than if a Stack Overflow page linked to the right documentation page to address a question. If the documentation goes away, the link of course dies. Nobody would expect anything else. It does not change the fact that posting the link was the correct answer to the question, and that it was a better answer than copy-and-pasting the whole documentation into SO.

The same is true for sites linking to Stack Overflow. You wouldn't expect everyone who linked to Stack Overflow to first copy and paste the whole site into their own blog, just in case Stack Overflow goes down, would you?

In terms of the latter concern, that too many outgoing referrals is bad for Stack Overflow's search rankings, copy and pasting isn't good either. Search engines consider cloning the contents of other sites to be "black hat SEO" and might in fact penalise sites which conduct themselves in this manner. More importantly, it just doesn't feel right for a site which is known for its openness.

In addition to not addressing the concerns voiced, cloning content from JSFiddle should be considered bad because:

  • Someone took the time to present their answer in a better, more useful format. Removing that formatting (or hiding it under a wall of copy and pasted unformatted code) lowers the quality of Stack Overflow answers.
  • It's against the DRY principle of coding. There's a proper page with the correct answer. Repeating it introduces inefficiency.
  • The code on JSFiddle is fully tested. You cannot "test" code quoted in a SO answer. The JSFiddle code is likely to be of a higher standard.

An Alternative Proposal

I propose that any concerns about "link juice" and page rankings are simply forgotten. The web is open, Stack Overflow benefits from it, and the web should benefit from Stack Overflow. This is the meaning of "web" - things are connected. SO is doing great in page rankings already.

On the second concern, the matter of dead links, I propose a non-intrusive technical solution instead: if a link appears to be dead, display a popover to the reader of the answer. "This JSFiddle link seems broken. Would you like to view our cached copy of the code instead?"

The code would be cached automatically at the time of posting.

If there is concern that the code cannot be cached because of licensing issues, then the author of the answer including the link could be asked to confirm they authorise SO to save a cached copy (of only the code itself, not the JSFiddle site itself as the author is unlikely to be able to authorise that).

Note that the cached copy is never even mentioned if the link is not actually bad. This is in consideration of the open spirit of the web and the fact that, again, it improves the quality of the SO answer when JavaScript code is presented in a tested, DRY and ready-to-use manner.

-2

I don't like this feature. I absolutely shamelessly hacked around it by adding an empty "block of code"

-

And then linking to jsFiddle.


The right answer to this question is either implement jsFiddle on SO or don't do lame hacks like this at all.

7
  • You can post feature request asking to not activate the block if the fiddle contains no JavaScript just HTML like in your case. Commented May 22, 2013 at 23:02
  • I'm not going to apologize for being brutally honest.
    – bobobobo
    Commented May 23, 2013 at 14:00
  • Nobody asked you to apologize. Commented May 23, 2013 at 14:02
  • It's fine that you worked around it, no one cares. The benefits of this feature far outweigh the occasional annoyance of it.
    – user159834
    Commented May 23, 2013 at 14:15
  • I will add though that I believe your post is a decent (but rare) example of linking to jsfiddle without really requiring code in the post. If you'd like to bring this up in a more constructive manner and in a separate post, I think you'd have some support.
    – user159834
    Commented May 23, 2013 at 14:23
  • 1
    +0 I agree with the not implementing shameless hacks, but not hacking around it. Instead, we should put effort into educating users to post self-contained questions. Commented Jun 25, 2013 at 0:05
  • 1
    Here's an example of a very long, detailed question. I was asked for a link to jsfiddle but couldn't add it... stackoverflow.com/questions/23001679/… Commented Apr 11, 2014 at 16:21

You must log in to answer this question.