7

When you want to share any Stack Exchange comment you grab its link, eg.

https://rpg.stackexchange.com/questions/165696/if-my-character-exchanges-a-crossbow-for-a-longbow-how-do-my-attack-and-damage#comment440364_165696

At the end you can see: 440438_165697 which is comment's id and answer's id. What is the reason of storing answer's id there? You could easily locate that element on page without having answer's id attached.

2
  • 1
    I can only guess, but one reason could be in case the comment has been removed but its contents can be found nearby, e.g. if it was edited into the answer, moved to chat, or if the comment deleted but the gist of it might be inferred from context.
    – kaya3
    Commented Mar 3, 2020 at 14:40
  • 10
    If the comment is deleted, then you'll still be taken to the answer it was on. Otherwise if you just went to the question's page you would lose that context.
    – Thom A
    Commented Mar 3, 2020 at 15:43

1 Answer 1

8

The # in the URL is called a URL fragment. It's designed to take you to a certain spot in the HTML on the page.

Now let's say a comment has been deleted. If the URL depended on the comment still being there, you'd be stuck. The question would be unreachable via the comment URL. As such, the fragment allows you to load the URL with or without the comment. If it's deleted, your browser will simply stay at the top.

1

You must log in to answer this question.

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