18

Example: If I want to answer some question, and I want to link to another answer.

I can link normally like:

as Tsvetomir Tsonev's [answer][1]*

[1]: http://stackoverflow.com/a/178450/622813

But this link will reload as a normal link.

Why can't I do a link like an anchor?

as Tsvetomir Tsonev's [answer][1]*

[1]: #178450
  • 1
    Is this a feature request then? – Oded Nov 29 '13 at 8:36
  • It is ... ? @Oded done :D – l2aelba Nov 29 '13 at 8:39
  • @Oded I wasn't sure if it is possible and I just don't know how, or is it not possible yet. I guess OP might have similar doubt... so if you could be so nice and confirm it's not implemented at the moment? – Mołot Nov 29 '13 at 8:53
  • 1
    This is not currently supported. We require an http to recognize a link as such. – Oded Nov 29 '13 at 9:05
  • AFAIK, we have to open a new browser tab with the shortlink, and this will produce the full anchored URL. – brasofilo Nov 29 '13 at 11:57
  • 7
    Note that another answer of the same question does not necessary be on the same page. – Alvin Wong Nov 29 '13 at 15:16
  • I got the feeling they removed my earlier comment from here? – n611x007 Jan 19 '17 at 2:15
14

You can't do a direct anchor link. Do what you're already doing and use the share link you get beneath their post:

click the "share" button and copy the URL that pops up

This works just fine and is resilient to scenarios which can make a simple #anchor link fail (question migration, the question has 30+ answers and is now paginated with the answer you're linking to on a different page, or someone views your post revision independently). Plus, using the share URL can get you the announcer, booster and publicist badges.


There is one way to create an anchor link that involves no page reload. This method is unreliable and broken by basic site interactions; I don't recommend using it ever and I'm only describing it for comprehensiveness. Use the share link.

Take the full URL of the question and strip it down to a domain-relative link (e.g. for this question, /questions/209342/how-to-link-as-an-anchor-link-to-another-answer-in-same-page). Append the anchor ID onto that manually (#209580 for this answer) to get a URL that jumps to an answer without reloading the page: here it is in action. This also accounts for the popular HTTPS Everywhere addon, and site migrations.

This method only saves a page load if I'm already on the exact URL you're assuming. That means this method is broken by title changes, by a trailing slash, by visiting this page via an answer share link or after editing an answer (appends a /post_id to the URL), or via a notification (appends ?noredirect=1). It also breaks of there's >30 answers and thus the question is paginated, and my current sort mode (active/oldest/votes) pushes that answer onto another page.

You avoid these breakages by keeping up with all title changes, ensuring everyone is on the same URL first (give them a master link to click), and working around the 30+ answers issue somehow (ask everyone to use the right sorting method?).

I recommend this trouble is not worthwhile for avoiding something as trivial as a page reload, and that you just use the share link.

  • 4
    @Marc -1 for non free hand circles! – ShaWiz Dec 2 '13 at 8:30
  • 2
    @ShaWizDowArd I use a trackball with my off-hand; I'm not sure I'm up to circles... – Marc Gravell Dec 2 '13 at 9:09
  • @ShadowWizard Three years and a month later, and freehand circling has been delivered. :) – doppelgreener Jan 17 '17 at 17:01
  • @doppelgreener heh, about time! ;) – ShaWiz Jan 17 '17 at 17:27
  • @n611x007: I have no idea what you're talking about or how you got here or why you downvoted a perfectly reasonable answer to this question just because you were expecting to see something else. But on the off-chance you followed an old MSO link and got here somehow, keep in mind that the MSO/MSE split was more than two years ago. – Nathan Tuggy Jan 17 '17 at 20:14
  • 1
    This answer didn't contain the second (highly inadvisable) part until today, but it did still say just use the share link, which is still the only worthwhile way to do this. – doppelgreener Jan 17 '17 at 20:35

You must log in to answer this question.

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