HOW TO make Google skip redirection step on clicking search result


There have been times when I wanted to just copy the URL of a site mentioned in a Google search result without having to go to the website & then copying it from the address bar.


However when I right click & copy the URL, this is how the address typically looks -
http://www.google.com/url?sa=t&rct=j&q=menu_elements_selector
&source=web&cd=5&cad=rja&ved=0CEIQFjAE
&url=http%3A%2F%2Fapi.jquery.com%2Fattribute-ends-with-selector%2F
&ei=LdQ8UKOkJYPTrQfn0IHIDA
&usg=AFQjCNFmICOvDtxuImTTeXY3pCDQNW6yVQ

(URL broken with new lines for readability & to preserve formatting)

Digging into the source code reveals that there is a mousedown event that fires up when the link is accessed & re-creates the HREF of that anchor tag so that you have to pass through a quick additional Google step before you can reach the search result site

I wished there was a bookmarklet that could stop Google from mangling the URL and skip the redirection step. Guess what, there is bookmarklet Zap Events that can remove all JavaScript events assigned to elements in a web page.

It only zaps the following 4 events - "mouseover","mouseout","unload","resize". I tweaked the code a bit to include the "mousedown" event as well -

javascript:(function(){var%20H=^
["mouseover","mouseout","unload","resize","mousedown"],^
o=window.opera;%20if(document.addEventListener/*MOZ*/&&!o)^
%20for(j%20in%20H)^
{document.addEventListener(H[j],function(e)^
{e.stopPropagation();},true);}^
%20else%20^
if(window.captureEvents/*NS4*/&&!o)%20{%20^
document.captureEvents(-1/*ALL*/);^
for(j%20in%20H)^
{window["on"+H[j]]=null;}}%20else/*IE*/%20{function%20R(N)^
{var%20i,x;for(j%20in%20H)^
if(N["on"+H[j]]/*NOT%20TEXTNODE*/)N["on"+H[j]]=null;^
for(i=0;x=N.childNodes[i];++i)R(x);}R(document);}})()

(remove  ^ & newline character when you're using this code)

With this modified bookmarklet, I can now copy the actual URL in a Google Search result.

Update 5/Sept/12: Found that this redirection feature bugs a lot of people. This thread on the StackExchange WebApps forum has simpler bookmarklet code to address this issue:

javascript:function rwt(a,f,g,l,m,h,c,n,i){return a};

Related:


Comments