HACKER Q&A
📣 thinkloop

Why does Google search redirect links instead of using JavaScript?


I am sure you have noticed that google search results point to a google.com link first instead of the actual result directly. This comes with a heavy price in terms of speed and usability.

Why does google not instead silently track the link using JavaScript when JavaScript is available? Is it in case of link sharing? If so, is that not an overly heavy cost for an uncommon use-case?


  👤 gregjor Accepted Answer ✓
I'm not seeing that. Searching for "honda motorcycles" I get a page of links that look like this:

  

Motorcycles - Honda Global

global.honda › products › motorcycles
It uses the ping attribute to track the clicks. Sponsored ad links look a little different.

I'm using Chrome. I don't think the ping attribute is supported in all browsers so in other browsers Google most likely does the redirect to accomplish the same thing -- track clicks on search result links and capture whatever it can get from the browser.

You can't just "silently track the link using JavaScript." One way or another Google is going to track clicks on search results, whether through a redirect, a ping, or JS code sending an AJAX request. However you look at it your browser is going to make at least one additional HTTP request along with following the link.


👤 kamban
I had noted the same in the past. It does not seem to happen on latest chrome. As another user pointed, it could be browser specific.