What is the meaning of # in URL and how can i use

2019-01-07 07:31发布

I often found some URL which looks like 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 ?

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

Edit: I am not the owner of some website but when I am concern with some particular portion of some web-page then how can I give the url with # and give that url to another ?

I am concern with answer portion on my profile 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.

标签: url
7条回答
时光不老,我们不散
2楼-- · 2019-01-07 08:01

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

查看更多
beautiful°
3楼-- · 2019-01-07 08:04

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

查看更多
三岁会撩人
4楼-- · 2019-01-07 08:10

Yes, it is mainly to anchor your keywords in particular 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 page will scroll and bring computer related topics to the top.

查看更多
smile是对你的礼貌
5楼-- · 2019-01-07 08:14

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

查看更多
Lonely孤独者°
6楼-- · 2019-01-07 08:18

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.

查看更多
Anthone
7楼-- · 2019-01-07 08:24

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

Please see this page for more details.

查看更多
登录 后发表回答