开发者

urls containing the # signal at the end [duplicate]

开发者 https://www.devze.com 2023-02-21 12:18 出处:网络
This question already has answers here: 开发者_高级运维 Closed 11 years ago. Possible Duplicate: url having #! How is it useful For example facebook has www.facebook.com/#!
This question already has answers here: 开发者_高级运维 Closed 11 years ago.

Possible Duplicate:

url having #! How is it useful For example facebook has www.facebook.com/#!

Can someone explain the meaning of the # at the end of some url addresses? (twitter for example) Is it a convention for something?

EDIT: I want to clarify that I'm talking about using a # at the END of an url


It's a reference to a "named anchor" - a link on a particular part of the page. If you have <a name="foo"> on a page then visiting .../page.htm#foo will take you to that place on the page.

If you're already on that page and the named link doesn't exist then visiting that anchor will just leave you where you are.

AJAX-based applications take advantage of that fact to store extra state information. Any time Javascript code changes document.location.hash it creates a new browser history entry, but doesn't cause a page reload. The JS code can listen for changes to that property and update their state based on its contents.

0

精彩评论

暂无评论...
验证码 换一张
取 消