views:

129

answers:

3

If you click on a result in Google Instant, the referer sent by your browser to the destination website contains a bunch of parameters, including the all important q=[autocompleted query]

But you're coming from a page whose URL is simply http://www.google.com/ with a bunch of stuff after the # character, i.e. as an on-page anchor.

So the browser appears to be sending a URL as the referer which is different from the URL of the page that you were viewing when you clicked.

There doesn't seem to be an additional redirection, so how on earth do they do that?

A: 

What Google are you using?

My URL after searching is this:

http://www.google.es/#sclient=psy&hl=es&q=something+to+search&aq=f&aqi=g4g-o1&aql=&oq=&gs_rfai=&pbx=1&fp=b0....

It does include the q= part

LatinSuD
Yes, but the q= part is in the anchor (after #), not part of the main meat of the URL itself. Anchor are generally not sent through as HTTP referers.
Butters
A: 

The page anchor part of the URL can be manipulated client-side without a new request to the server. Even when talking about static anchor links (e.g. <a href="#foo">Section Foo</a>), clicking on them does not cause a new request to be sent to the server; it is processed completely within the browser.

The javascript being used by Google to make Google Instant work is simply altering the anchor programatically before making a request to the server.

Tyler McHenry
Yes, but that's not my question! How does it get stuff from the anchor included in the HTTP referer sent to the result I clicked on?
Butters
+3  A: 

Most of the time, a Google search result actually sends you to a Google redirect page rather than directly to the target page. They use JavaScript to switch the target of the link onmousedown as you click on it.

You can see this effect by click-and-holding on the search result link and watching your status bar.

This isn't specific to Google Instant, they've been doing it for quite a long time on their standard results pages.

Gareth
I guess that explains it - thanks!
Butters
It does not work for me (in Firefox); I'm getting just www.google.com as Referrer, which is the current URL without the hash/anchor part.Apparently the set-referrer-using-Javascript fails on me. Chromium works fine - so it's maybe one of the Firefox extensions or something similar blocking this.
blueyed