html的url中写什么,html – url中的#符号是什么

#后面的URL(包括和)的部分是

fragment identifier.它的其余部分是特殊的.要记住的关键是“仅客户端”(当然,客户端可以选择将其发送到服务器……而不是作为片段标识符):

The fragment identifier functions differently than the rest of the URI: namely, its processing is exclusively client-side with no participation from the server — of course the server typically helps to determine the MIME type, and the MIME type determines the processing of fragments. When an agent (such as a Web browser) requests a resource from a Web server, the agent sends the URI to the server, but does not send the fragment. Instead, the agent waits for the server to send the resource, and then the agent processes the resource according to the document type and fragment value.

虽然过去常常只使用“锚点”,但它现在用于在许多基于JavaScript的站点中存储可导航状态 – 例如,gmail大量使用它.并且,就像这里的情况一样,有一些“photoshare”JavaScript也使用片段标识符进行状态/导航.

因此,如所怀疑的,JavaScript“捕获”片段(有时称为“哈希”)更改并执行AJAX(或其他后台任务)来更新页面.片段更改时页面本身不会重新加载,因为URL仍然引用相同的服务器资源(片段标识符之前的URL部分).

较新的浏览器支持onhashchange事件,但是通过各种轮询技术已经支持监视很长时间.

快乐的编码.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值