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.
精彩评论