#后面的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事件,但是通过各种轮询技术已经支持监视很长时间.
快乐的编码.