gDirectLinks

When you click a link in Google search results, Google sometimes (or always?) uses JavaScript to replace the actual link with an indirect one, which they use for click tracking. The indirect link then redirects the browser to the actual destination after logging the click. You can tell when this is being done by dragging a search result link until its URL is revealed: if the URL begins with http://www.google.com/url? instead of the destination’s actual address, it’s an indirect link.

This extension disables the JavaScript that replaces real links with indirect ones, so that when you click a Google search result link, Safari goes straight to the destination. It works on Google Instant results as well as the conventional ones.

Optionally, it can also rewrite the links in Google image search results so that clicking a thumbnail will open the linked image directly. The setting is in the gDirectLinks area of Safari’s extension manager.

Why?

There are three main reasons you might want to use this extension.

First, it ensures that true URLs, and not Google’s indirect URLs, are recorded in Safari’s history. If you frequently use Safari’s History menu, you may have noticed that when you open a Google search result in a new tab, such as by ⌘-clicking it, the URL that shows up in the History menu is the indirect one. That’s not very helpful, since you can’t tell at a glance what page or site the URL refers to. (Apple has fixed this problem in Safari 5.2, which as of this writing is not yet in general release.)

Second, it lets you more easily copy actual links from search results. Normally, if you right-click a search result link and select Copy Link, what you get will be the indirect link, which looks something like http://www.google.com/url?sa=t&rct=j&q=example&source=web&cd=5&ved=0CPABEBYwBA&url=http%3A%2F%2Fexample.org%2F&ei=uhuzT5mMNIuGiQKvnZmtBA&usg=AFQjCNFbkYxzDIXuUwBwoB2QRwTWALaVrQ. Although you can extract the real destination URL from that mess, this extension makes it so you don’t have to.

Finally, maybe you just don’t want Google tracking which search results you are clicking. Please note, I don’t guarantee that this extension will stop Google from tracking your search result clicks. What it does specifically is to remove the JavaScript onclick handler that Google uses to replace direct links with click-tracking ones. However, I can’t say for sure that they don’t use any other method to track your clicks.

Notes

If you enable the option to rewrite image search links, clicking a thumbnail will open the linked image directly, and clicking the filename below the thumbnail will directly open the page that contains the image.

This extension’s functionality is a subset of LinkThing’s. If you use LinkThing and enable the Google link rewriting option, you don’t need gDirectLinks.

2012 Canisbos Computing
Creative Commons License

Notes