TL&DR: Yes, do flag link-only answers.
The user perspective
In the past, on such link-only answers, I used to just leave a comment asking the answerer to provide context for links. I would only downvote or flag as not-an-answer (or spam if applicable) if the content of the link was not relevant to the question.
But really, consider the value of a link-only answer:
- For the reader, it's not directly helpful. And very often, while the content behind the link is helpful, its applicability to the question is not immediate. Even if the content is helpful, what if the linked site goes away? What if the reader is reading an offline copy of the question page?
- For the answerer, such an answer represents zero effort. Given the existence of reputation, an upvote is supposed to reward the answerer in a way. Why reward someone who couldn't be bothered to write even one relevant sentence?
- For the reviewer (i.e. a potential voter/flagger), following the link is extra effort. Each reviewer and each reader ends up doing that extra effort that was the answerer's job in the first place.
So now, my policy is to judge an answer by its explicit content alone. Links are an extra bonus, and indeed an answer can be better because it includes links to code samples or reference documentation. But if an answer only reads “see this link”, then I'll vote on it based on what I see. At the moment, I downvote and comment on such answers, because I think it's more effective in discouraging these answers than a not an answer
flag that won't be followed through (unfortunately, some moderators, especially on Stack Overflow, refuse to delete link-only answers). But ideally, such answers should be deleted (or improved).
Oh, and if you see a question which has one answer with just a link to relevant content, it's legitimate to write a competing answer with the content (summarized or rephrased), plus the link as a reference, and downvote (and flag for deletion) the link-only answer.
(Note that an answer like “you want the Foo.Bar
module <link to the official documentation>”, to a question like “how to I do task X in environment Y?”, is not a link-only answer. The name of the module is the most important part of the answer, and it's included directly in the answer, so that's fine. If the answer didn't have the module name in an apparent way, the appropriate reaction would be to edit it, e.g. replace [use this](http://example.com/Foo.Bar)
by use [Foo.Bar](http://example.com/Foo.Bar).
.)
The moderator perspective
(This section spells out the logical consequence of the first section, plus some additional advice for moderators.)
A link-only answer is not a desirable answer. Therefore, any flag that suggests the deletion of a link-only answer should result in the deletion of the answer, and should be marked as helpful.
If the link looks like it may be useful, convert it to a comment. A link that is spammy, redundant or irrelevant should be deleted outright; a link to a page that looks like it contains the answer should ideally be in a comment (“here's something you could extract an answer from”). If in doubt, converting to a comment is the best default choice: it removes the clutter from the answer section while preserving the information.
If you're feeling extra helpful, you might leave a comment to explain why you deleted the answer. A canned comment can fit most link-only answer.
Please [do not post an answer that consists essentially of a link](https://stackoverflow.com/questions/how-to-answer). Include the important points in your answer; leave the link for extra information or as a reference.
or this one:
Welcome to Stack Exchange. This is a [questions and answers site](https://stackoverflow.com/about), not a link collection. Please include relevant content in your answer, not just a link to where the content may be. The link is nice to have in addition for reference or for further information. For more tips, see [How to answer](https://stackoverflow.com/questions/how-to-answer).
Leaving a comment is especially important on young sites where it is important to welcome and guide new users; if you're an SO moderator who handles hundreds of flags a day, I expect you to click “delete” and move on. The comment has to be left by the moderator just before deleting the answer, even if the flagger has already left a comment, because posters are not notified of comments on their deleted posts except when the comment is left by the moderator deleting the answer just prior to the deletion.