URL 中 # 的含义是什么,我该如何使用它? [英] What is the meaning of # in URL and how can I use that?

查看:37
本文介绍了URL 中 # 的含义是什么,我该如何使用它?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我经常发现一些像下面这样的网址:

I often found some URL which looks like the following:

www.something.com/some_page/#someword

写完这个页面后,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.

我不知道#"是什么意思.一旦我使用任何 URL 生成 #someotherword,它有时会起作用,有时则不起作用.

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.

我没有得到 URL 中的 # 内容.它是否具有任何语言或 URL 或其他任何功能?

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.

我不是某个网站的所有者,但是当我关注某个网页的某些特定部分时,我如何将带有 # 的 URL 提供给另一个?

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?

我关心的是我个人资料中的答案部分,然后我会准备好下面的 URL 并将其提供给某人.

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

这有效,但有时无效.

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

那行不通.

我只是一个用户,我不想知道网站是用哪种语言构建的.

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

推荐答案

原本是用来作为锚点跳转到同名/id元素的.

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

但是,现在它通常用于基于 AJAX 的页面,因为可以使用 JavaScript 检测更改哈希值,并允许您使用后退/前进按钮而无需实际触发整个页面重新加载.

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.

这篇关于URL 中 # 的含义是什么,我该如何使用它?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆