You are here

End the redirect wrapper on links


A lot of sites, most notably search engines like Google, like to rewrite all the links on their pages. So search for this page and instead of, the link Google gives you is or similar. (I have redacted the actual codes.)

What's happening is that when you click on the link, you really go to Google. Google records what you clicked on and other parameters related to the search so they can study just how people use their search engine, what they click on and when. It's a reasonable thing for them to want to study, though a potential privacy invasion.

Because each click goes through Google, your clicks are slowed down. Because Google has such huge resources, and is almost never down, you usually don't notice it, though even with Google you will see the delay on slow links, like mobile GPRS and Edge connections. It also means you can't easily cut and paste links from search results.

Other sites are not as good. They sometimes noticeably slow own your click. Worse, they sometimes break it. For example, on my phone, when I click on links in LinkedIn messages, as well as Facebook ones, which are also redirected, it doesn't work if I'm not currently logged in to those sites. Due to some bad code, it also wants to send the link to the mobile apps of these sites, which is not what I want. (The one for LinkedIn is particularly broken, as it doesn't seem to know where the app is, and sends me to the Play store to install it even though it is already installed.)

In other words, these links break the web from time to time. They can also interfere with spiders. On the plus side, they can be set to protect your privacy by hiding data in the REFERER field from the target web site. For sites that have been identified ad malicious, they can provide a warning.

To fix this, sites can change all their links to be javascript. The link can be a real target, and associated onClick javascript can also send a web hit back to the server with the logging info.

A better solution would be to push use of the "ping" attribute in the HTML spec, and allow links to have both an href to the target, and another URL which gets invoked when the link is clicked. In the background, this would not slow down your click, or break it. Browsers could also elect to block it, which the sites might not like but is good for users. Links to malicious sites could be treated differently if that's part of the service. There would also be no need to fake the status window when moving the mouse over the link, as must be done with redirects.

Let's say no to all these redirects.


Definitely a problem at many sites, and layers of redirection/minification often cause problems following links from Twitter, but...

I haven't seen Google do this kind of redirect-wrapping on search results in a while. They're doing something else with Javascript instead. (And, not even the thing they did for a while, where the mouseDown added the wrapping URL, so the mouseUp went to a different URL than what was there when you started a click.) Perhaps other Google sites aren't yet with the program... but search results are.

There is HTML5 spec support for this, too, the 'ping' attribute of A elements...

...though can't recall seeing it used in the wild, compared to JS approaches.

My error in not knowing this had been added, because I have not seen it used much. I updated the text. And no, google does redirects. The ones that are bothering me the most right now are LinkedINs which are actually causing a referer loop in firefox, as well as insisting you be logged in to linkedin to click on a link in an email they forwarded you.

More than the privacy issue, these link wrappers annoy me because they break the ability to copy and paste the original URL. For example, I often search for academic papers with Google, and the results page are full of helpful links to PDFs and word processing documents which my browser helpfully opens using an external document viewer or word processor. If I want to share the location of these documents with my colleagues, then simply right-clicking on the link and selecting "Copy link location" doesn't work, since it's the horrible link-wrapped URL which gets copied to the clipboard. And since my browser opens such links in an external application (after automatically following the HTTP redirect), there's no easy way to get it to show me the target URL. I'm reduced to opening up a terminal and using something like wget, whose logging output shows me the redirect targets.

There are various browser extensions and Greasemonkey scripts which can be used to strip these link wrappers. However, these require a bit of technical literacy to find and install. And neither these workarounds nor the wget one will necessarily work when you're using someone else's computer where you don't have the permission or ability to install software.

Add new comment

Subscribe to Comments for "End the redirect wrapper on links"