Friday 6 January 2012

Copy Pasting Google's Search Results Made Easy

Shmuelie has written a post discussing the code, which you can find on his blog.


I was answering a few questions on Stackoverflow and remembered a few sites I could link to as a reference. A quick Google search and the sites were displayed. I right-clicked on the link and copied the link shortcut. All good so far, but when I pasted it, it was full of Google's injected metadata and query strings. A complete mess which meant I had to visit the site and copy the address directly from the address bar.
E.g. If I search for 'keyboardP' on Google, my Twitter account is the first result. I right click on it, copy the shortcut and this is what I get on my clipboard:

www.google.co.uk/url?sa=t&rct=j&q=keyboardp&source=web&cd=1&ved=0CD4QFjAA&url=http%3A%2F%2Ftwitter.com%2FkeyboardP&ei=Jj0HT5CYPJOV8gOYtuTBAQ&usg=AFQjCNH0ZfBO-taQlRRUyy10Sh2lsl9sUA

You can try it for yourself. Search for anything on Google, right click on the page and select 'copy link shortcut' (or other options to that effect, depending on your browser). You'd expect to have the page's actual URL on your clipboard, but now try pasting it - probably not the link you want to share.

I tweeted a suggestion that Google should provide a 'copy link' button of some sort to allow users to copy the actual URL. This way, they can keep their analytics data but also make it easy for the user. Within moments, one of my followers, @Shmuelie, was on it like a shot and coded a quick bookmarklet.  Full credit to @Shmuelie for the script.

Bookmarklet - Drag the link below and place it in your bookmarks bar.
Allow Google Results Copy
To use - After performing the search, simply click the bookmarklet. You can now just right-click and copy any link on that page, as you'd expect to be able to. 


Google Instant (the feature that automatically displays the results as you type) might interfere, if you have it turned on. Easy fix - just click the blue search button before clicking the bookmarklet if you find that it does. ( I haven't :) )

3 comments:

  1. Thanks for your post. This is the simplest method I know. Save me a lot of headaches :)

    ReplyDelete
  2. Or you could use this greasemonkey script that doesn't require you to click the bookmarklet and even makes all the links direct, so you can reach them faster.

    http://userscripts.org/scripts/show/134151

    ReplyDelete