You can't do a direct anchor link. Do what you're already doing and use the share link you get beneath their post:
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.
http
to recognize a link as such.