0

Possible Duplicate:
What’s the shebang/hashbang (#!) in Facebook and new Twitter URLs for?

I see in several web-based application that uses Ajax request for loading pages, they use #! after urls instead of #. For instance: /boo.php#!Projects instead of /boo.php#Projects.

I want to know, is there any technical reason for doing like that or not?

Community
  • 1
  • 1
Afshin Mehrabani
  • 33,262
  • 29
  • 136
  • 201

3 Answers3

1

It is because the hashbang/shebang (#!) is Googles scheme for indexing AJAX pages:

When your site adopts the scheme, it will be considered "AJAX crawlable." This means that the crawler will see the content of your app if your site supplies HTML snapshots.

More info on Google Developers.

alexn
  • 57,867
  • 14
  • 111
  • 145
1

This is called a "hashbang". It's used by Google to index Ajax-based website. More info there - http://www.fakingfantastic.com/2011/02/09/using-hash-bangs-in-your-urls/

laurent
  • 88,262
  • 77
  • 290
  • 428
1

The intent is to make AJAX pages crawlable by e.g. Google.

Normally, everything behind a hash in a URL is irrelevant for a crawler and is not send to the server at all. In AJAX applications it used to be heavily used for "simulating" a real URL in the browsers address bar (people now typically use history.pushState).

To come around the limitation of not being ale to execute the full JavaScript application, Google invented a protocol that basically states that if it encounters a URL containing a hashbang like

http://example.com/foo#!key=value

it can transform it to

http://example.com/foo?_escaped_fragment_=key=value

And send it to the server. The server then is expected to return a representation of the page as it would have been shown in the JavaScript app. In the end it is just a convention to make these apps crawlable.

For more information, see the documentation on the topic by Google.

Holger Just
  • 52,918
  • 14
  • 115
  • 123