Google-Redirect

From Brett
Revision as of 08:07, 4 March 2014 by WikiSysop (Talk | contribs) (Created page with "Sometimes I encounter Google results pages but as service is unreliable here in China, I often want to get directly to the result rather than having the vain hope of waiting t...")

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Sometimes I encounter Google results pages but as service is unreliable here in China, I often want to get directly to the result rather than having the vain hope of waiting to go through Google.

While this bookmarklet will do the trick if already loaded:

var url = window.location.href.match(/[?&]url=([^&]*)(?=&|$)/);
url = url && url[1];
window.location = decodeURIComponent(url);

...usually Firefox just keeps on running, so I made the following page, google-redirect.html

<script>
var url = window.location.href.match(/[?&]url=([^&]*)(?=&|$)/);
url = url && url[1];
url = decodeURIComponent(url).match(/[?&]url=([^&]*)(?=&|$)/);
url = url && url[1];
window.location = decodeURIComponent(url);
</script>

...and I made a bookmark leading to it, but leading to:

file:///C:/Users/<my-path>/google-redirect.html?url=%s

...and with the keyword "redir", so I could quickly hit ctrl-l to get into the location bar, copy-paste the URL, type "redir" and space and then paste (ctrl-x) to redirect quickly to whatever URL was appended at the end of the URL. Probably sounds convoluted unless you've had to deal with the Google issues as over here.