Wednesday, February 13, 2008

Copying links from Google search results

You may have noticed that when you copy links from Google search results, you don't get what you expected -- when you hover over them, your browser says one thing, but when you right-click on them, it says another. For example, searching for snappletronics, Google gives you the code for a link like this: (emphasis not in original, obviously)

<a href=""
onmousedown="return rwt(this,'','','res','1','AFQjCNGxo5T82OPvPMIGpTmHTE3JzTBwzg','&sig2=vMD0Ey969KDVrwhFXwVgBw')">

What does this mean? It means that when you right-click on the link, some Javascript function gets to run and change the link, so the link turns from Snappletronics to Snappletronics (watch the tooltip or your browser's status bar). The second link tells Google that I clicked the link and maybe other identifying information. I believe this surreptitious link-changing is a pretty strong violation of "Don't be evil."

Fortunately, there's help if you use Firefox. If you have Greasemonkey, this script will remove their hooks and prevent them from changing the link on you.

Update (11.12.2010): The above script is now outdated. Depending on when you read this, this script might be a decent replacement.

No comments: