5

While browsing some popular websites, I noticed that occasionally the url would change to include these characters "#" or "#!". Why is this? From a programmers perspective, what techniques, technologies are they implementing to cause this. Is this a best practice for a certain solution?

Examples: http://twitter.com/#!/ http://www.facebook.com/#/

BoltClock
  • 700,868
  • 160
  • 1,392
  • 1,356
nathan
  • 51
  • 1
  • 3
  • 1
    possible duplicate of [What's the shebang/hashbang (#!) in Facebook and new Twitter URLs for?](http://stackoverflow.com/questions/3009380/whats-the-shebang-hashbang-in-facebook-and-new-twitter-urls-for) – mu is too short Mar 09 '11 at 17:40

2 Answers2

7

Here's a thorough explanation of hash-urls and hash-bang urls: HashURIs by Jeni Tennison.

Ned Batchelder
  • 364,293
  • 75
  • 561
  • 662
4

It is a in-document link. It's called anchor (or fragment) and it is used to link to certain parts within a page and have the browser directly scroll to the right part of the page.

Try this (and read the contents :-)) http://www.w3.org/TR/html4/struct/links.html#h-12.2.3

This browser mechanism has recently been exploited to perform certain advanced javascript/ajax tricks and it's being used extensively by facebook, twitter, etc. When doing so a general convention is to append a ! after the # to distinguish a javascript-bound anchor from a normal one.

tacone
  • 11,371
  • 8
  • 43
  • 60