33

We understand the hash is for AJAX searches, but the exclamation mark? Anyone know?

Also, the "action" attribute for their search form points to "/search," but when you conduct a search, the hash exclamation mark appears in the URL. Are they simply redirecting from "/search" to "/#!/search"?

Note: the second part of the q remains unanswered: That is, are they redirecting the user from "/search" to "/#!/search", or do they send the user to "/search" and use JS on the page to rewrite the URL? – Crashalot Jan 26 at 23:51

Thanks!

Crashalot
  • 33,605
  • 61
  • 269
  • 439
  • 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) - at least the first part anyway – BoltClock Apr 16 '12 at 17:59

3 Answers3

31

It's become the de facto standard that Google has established to ensure consistency and make ajax urls crawlable.

See http://code.google.com/web/ajaxcrawling/docs/getting-started.html

I believe they are using history.pushState. You can do history.back() in the console and it'll lead you back to the page.

meder omuraliev
  • 183,342
  • 71
  • 393
  • 434
  • 1
    Actually, I realized the second part of the question remains unanswered. That is, are they redirecting the user from "/search" to "/#!/search", or do they send the user to "/search" and use JS on the page to rewrite the URL? – Crashalot Jan 26 '11 at 23:51
23

Yes, it redirects with HTTP 302.

By the way, "!" is used to eliminate the case with an empty hash. "http://url#" will make a browser to slide to the top.

tester
  • 619
  • 1
  • 6
  • 5
10

To answer the second part then: It is redirecting you to /#!/search.

If you look at the response headers when going to http://twitter.com/britishdev (plug plug) you are returned a 302 (temporary redirect) with the Location header set as "Location: http://twitter.com/#!/britishdev"

Yes JavaScript is then pulling all your detail in on the destination page but regardless that is where you are redirected to.

BritishDeveloper
  • 13,219
  • 9
  • 52
  • 62