334

I have a problem on a website or project I'm working on.

I would like to just describe the problem and paste a link to the external site or source code repository (e.g., GitHub) in the question. Can I do this instead of posting code on Stack Overflow - seeing as it's much easier to find my problem on the live site, or by cloning my source repository?

If not, why not?

Return to FAQ index

1
  • 4
    More than a handful of times, problems have been because of a server issue or configuration, unrelated to the CSS/HTML/JS. I completely agree with the sentiment of the answers and believe folks should make a reproducible example (to hopefully find that the code isn't the problem so they can post a server question), but let's not forget there are edge cases where a link to the site can be helpful.
    – Brad
    Commented Feb 18, 2013 at 20:25

1 Answer 1

469

No, providing a link is not sufficient. The information needed to answer the question must be provided in the question itself. There are several reasons for this:

  1. A linked website or code will change over time: When you fix your website or external code repository, it will no longer demonstrate the problem and people won't be able to retrace the initial problem. This is why the code needs to be documented here on Stack Overflow, where it will be archived directly with the provided answers.

    The primary goal of Stack Overflow is to build an archive of questions and answers that are useful to people and situations beyond that of the person who asked the question originally. A question with just a link to code subverts this goal.

  2. It is easier to understand the problem without having to click a link: Requiring users to click a link to see the code is not user-friendly. When the code is directly in the question, you will get better answers. It will also be easier for people in the future with similar problems to verify that answers apply to their situation.

  3. Code must be licensed in such a way that it can be used in answers: Questions and answers here, including any code in them, are licensed with creative commons such that they can be freely reused and modified with proper attribution. Code from an external link is unlikely to be licensed in a compatible way. Including the code in the question itself licenses it in such a way that it is allowed to be used in answers.

    The licensing issue prevents us from editing your post and fixing it for you. Unless the external code is clearly licensed with a compatible license, it would be a copyright violation for anybody but the owner of that code to include it in your question.

Off-topic

Such a question is likely to be closed as off topic: "The question should be updated to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem." (Formerly: "This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal reproducible example in the question itself.")

What you should do instead

Debug it! Narrow down the problem, to where you can describe it with a useful, searchable title and a small bit of code. Don't just dump your entire page into the question — figure out which portion actually causes the problem, and include just enough code to reproduce it. Don't know how to do this? Ask!

Then post the code to reproduce the problem in your question, probably as a live demonstration using Stack Snippets. As some people are more used to them, consider additionally providing it on JS Bin and/ or jsFiddle. Since these are third party services and may be unavailable at any time, make sure your question can be understood without visiting these websites.

Debugging tips

Before you try to debug CSS or JavaScript, make sure your HTML source is valid. "Broken" HTML is one of the most common causes of rendering and other errors, and different browsers will handle invalid HTML in different ways. Validating your HTML can reveal serious errors, like mismatched tags or duplicate id attributes. While not all errors are crucial to rendering (missing alt attributes for example), you should still fix as many of them as possible before debugging other code.

Validation tools

Debugging tools

A tutorial about how to use such tools: JavaScript debugging for beginners.

See also

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .