64

I often found some URL which looks like the following:

www.something.com/some_page/#someword

After writing this page some_page will be open and then scroll will be set so that I can see that "someword" at beginning of my screen.

I don't know what the meaning of "#" is. As soon as I make #someotherword with any URL it works sometimes and sometimes it doesn't.

I am not getting what # is in the URL. Is it any functionality of any language or URL or something else?

It might be possible that you consider my question newbish, but I am not into web-designing technologies, I am simply curious about it.

I am not the owner of some website, but when I am concerned with some particular portion of some web page then how can I give the URL with # and give that URL to another?

I am concerned with the answer portion on my profile, and then I will prepare the URL just below and will give it to somebody.

https://stackoverflow.com/users/775964/mr-32#answers

This works, but some time it doesn't.

https://stackoverflow.com/users/775964/mr-32#tags

That doesn't work.

I am just a user and I don't want to know in which language the website is build.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Jeegar Patel
  • 26,264
  • 51
  • 149
  • 222
  • Does this answer your question? [What does #/ means in url?](https://stackoverflow.com/questions/38909084/what-does-means-in-url) – codeforester Sep 13 '21 at 19:15
  • apart from anchors it can also be used in Text Fragments this [answer](https://stackoverflow.com/a/72400036/12594882) – med benzekri Jun 28 '22 at 06:15

6 Answers6

64

Originally it was used as an anchor to jump to an element with the same name/id.

However, nowadays it's usually used with AJAX-based pages since changing the hash can be detected using JavaScript and allows you to use the back/forward button without actually triggering a full page reload.

ThiefMaster
  • 310,957
  • 84
  • 592
  • 636
28

This is known as the "fragment identifier" and is typically used to identify a portion of an HTML document that sits within a fully qualified URL:

Fragment Identifier Wiki Page

Duncan
  • 763
  • 1
  • 6
  • 9
8

It is an anchor for links within a page - also known as "anchor tag"

http://www.w3.org/TR/html4/struct/links.html#h-12.2.3

Udo Held
  • 12,314
  • 11
  • 67
  • 93
3

It specifies an "Anchor", or a position on the page, and allows you to "jump" or "scroll" to that position on the page.

rfmodulator
  • 3,638
  • 3
  • 18
  • 22
2

Apart from specifying an anchor in a page where you want to jump to, # is also used in jQuery hash or fragment navigation.

Huske
  • 9,186
  • 2
  • 36
  • 53
1

Yes, it is mainly to anchor your keywords, in particular the location of your page, so whenever URL loads the page with particular anchor name, then it will be pointed to that particular location.

For example, www.something.com/some_page/#computer if it is very lengthy page and you want to show exactly computer then you can anchor.

<p> adfadsf </p>
<p> adfadsf </p>
<p> adfadsf </p>
<a name="computer"></a><p> Computer topics </p>
<p> adfadsf </p>

Now the page will scroll and bring computer-related topics to the top.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
manny
  • 1,878
  • 2
  • 15
  • 31
  • 2
    It needs to be `"id=computer"`. See [HTML 4 Specification #12.2.3](http://www.w3.org/TR/html4/struct/links.html#h-12.2.3) – user207421 Feb 04 '18 at 23:04
  • Thanks, name mainly to suite anchor, if you want to support more than that then id is preferable. – manny Feb 11 '18 at 17:25