thumbnail image for this experiment

link neutraliser


recently, i have come across various sites which like to run any external links through one of their own scripts (Perl, PHP, ASP, whatever) first, which then redirects the user to the intended destination.

instead of a link like <a href="">bar</a> you see things more along the lines of <a href="/cgi-bin/redirect.cgi?url=">bar</a>

now, in many cases this can be quite legitimate. often, it's just there to create a log of which external links are most popular, or to do things like tracking click-through rates.

in some instances, however, this technique is used to cram in any extra interstitial advertising ("you'll get to this page after a short message from our sponsors...") or even redirections to completely unrelated sites.

so, to get around at least some of these nefarious tricks and to try my hand at crafting a bookmarklet - kids nowadays assure me these are the latest craze - i present you with the link neutraliser.

the code is fairly simple: it simply loops through all links in the current document and looks for any occurrence of =http:// in the link's href attribute, which strongly suggests that a URL is being passed as a GET attribute. if it finds it, it replaces the href with what is hopefully the destination of the presumed redirection.


view this experiment