Prevent Google redirect?

General discussion and chat (archived)
fillerup

Prevent Google redirect?

Unread post by fillerup » 2019-01-22, 02:33

back on google now that their captcha system no longer trips on every search for me, and because DDG and Startpage are still very subpar compared to what big bad G offers. however, i'd still like to block this redirect that occurs each time i click a search result (not when i just hover my mouse the link).

tried a couple of addons from CAA and a script from Greasyfork, all to no avail

Image

vannilla
Moon Magic practitioner
Moon Magic practitioner
Posts: 2193
Joined: 2018-05-05, 13:29

Re: Prevent Google redirect?

Unread post by vannilla » 2019-01-22, 02:55

You can always copy the address displayed under the link.
It's not great but it's a "last resort" solution, which is better than nothing.

fillerup

Re: Prevent Google redirect?

Unread post by fillerup » 2019-01-22, 02:59

yep i've been doing that, but as you say it's hardly feasible as a long term option. especially when you need to open dozens of results at the same time

User avatar
Isengrim
Board Warrior
Board Warrior
Posts: 1325
Joined: 2015-09-08, 22:54
Location: 127.0.0.1
Contact:

Re: Prevent Google redirect?

Unread post by Isengrim » 2019-01-22, 03:44

If you install Greasemonkey, there are a number of userscripts out there that will remove the redirect from their search results. I believe there are also a few FF extensions that will do this, like CleanLinks.
a.k.a. Ascrod
Linux Mint 19.3 Cinnamon (64-bit), Debian Bullseye (64-bit), Windows 7 (64-bit)
"As long as there is someone who will appreciate the work involved in the creation, the effort is time well spent." ~ Tetsuzou Kamadani, Cave Story

User avatar
karlkracher
Fanatic
Fanatic
Posts: 129
Joined: 2015-12-05, 17:40
Location: berlin / germany

Re: Prevent Google redirect?

Unread post by karlkracher » 2019-01-22, 04:33

How to copy the link? The change in the address is done with a onmousedown handler, means opening the context menu does the change. I'm new to greasemonkey scripts but this one seems to be working by removing this handler

Code: Select all

// ==UserScript==
// @name        no_google_redirects
// @namespace   nogore
// @description remove google search redirects
// @include     https://www.google.*/search?*
// @version     1
// @grant       none
// ==/UserScript==

function main()
{
    var count = 0;
    var lliste = document.getElementsByTagName('a');
    for (var i=0; i<lliste.length; i++)
    {
        if (lliste[i].hasAttribute("onmousedown"))
        {
            lliste[i].removeAttribute("onmousedown");
            count++;
        }
    }
    console.log("removed "+count+" redirects from "+lliste.length+" links");
}

main();
Also in google news but not in the image search. Comments?

(Google news if choosen from the menu on the google search side, not with news.google.com)

fillerup

Re: Prevent Google redirect?

Unread post by fillerup » 2019-01-22, 13:56

Isengrim wrote:If you install Greasemonkey, there are a number of userscripts out there that will remove the redirect from their search results. I believe there are also a few FF extensions that will do this, like CleanLinks.
good suggestions. sadly, there's only one on Greasyfork that does not work, and i just realized CleanLinks only cleans up the url in the urlbar rather than preventing the redirect from happening.
karlkracher wrote:snip
hey, thank you for your work. i installed it as a Greasemonkey script and unfortunately it doesn't seem to have any effect. the symptom that i described in the OP remains, as the google redirect link still appears in a flash when you click on a search result.

also, i just noticed that the redirect only occurs once for each result for each time you search. e.g. if i click a link, it redirects, i hit ESC, then click the link again, no more redirect. same happens if i attempt to click on another search result in the same page, the redirect link only appears for the first click

User avatar
Isengrim
Board Warrior
Board Warrior
Posts: 1325
Joined: 2015-09-08, 22:54
Location: 127.0.0.1
Contact:

Re: Prevent Google redirect?

Unread post by Isengrim » 2019-01-22, 16:00

fillerup wrote:also, i just noticed that the redirect only occurs once for each result for each time you search. e.g. if i click a link, it redirects, i hit ESC, then click the link again, no more redirect. same happens if i attempt to click on another search result in the same page, the redirect link only appears for the first click
IIRC this is just how Google's scripting works; when the link is clicked with any mouse button, the redirect URL is replaced with the actual URL.
a.k.a. Ascrod
Linux Mint 19.3 Cinnamon (64-bit), Debian Bullseye (64-bit), Windows 7 (64-bit)
"As long as there is someone who will appreciate the work involved in the creation, the effort is time well spent." ~ Tetsuzou Kamadani, Cave Story

User avatar
therube
Board Warrior
Board Warrior
Posts: 1651
Joined: 2018-06-08, 17:02

Re: Prevent Google redirect?

Unread post by therube » 2019-01-22, 17:14

If you use NoScript, that does it (for Google, but not Yahoo).

google-search-link-fix-1.4.9.1-signed.xpi looks to work.

fillerup

Re: Prevent Google redirect?

Unread post by fillerup » 2019-01-22, 18:28

therube wrote:If you use NoScript, that does it
by 'it' which are you referring to?
therube wrote:google-search-link-fix-1.4.9.1-signed.xpi looks to work.
perfect, thank you very much

User avatar
karlkracher
Fanatic
Fanatic
Posts: 129
Joined: 2015-12-05, 17:40
Location: berlin / germany

Re: Prevent Google redirect?

Unread post by karlkracher » 2019-01-22, 18:37

Sorry, i would like to know why it isn't working for you, here it does (what does the browser console says about removed redirections), but if you have another working solution the problem is solved.

fillerup

Re: Prevent Google redirect?

Unread post by fillerup » 2019-01-23, 04:49

karlkracher wrote:Sorry, i would like to know why it isn't working for you, here it does (what does the browser console says about removed redirections), but if you have another working solution the problem is solved.
hi sorry, it turns out i somehow omitted the last few lines when copying the script over. it works as expected now :)

User avatar
karlkracher
Fanatic
Fanatic
Posts: 129
Joined: 2015-12-05, 17:40
Location: berlin / germany

Re: Prevent Google redirect?

Unread post by karlkracher » 2019-01-23, 13:22

I thought what might be the problem, glad to hear it was so easy. Thanks.

Fedor2

Re: Prevent Google redirect?

Unread post by Fedor2 » 2019-01-23, 13:46

The addon google search link fix still works, at least on duckduck and yandex.

User avatar
therube
Board Warrior
Board Warrior
Posts: 1651
Joined: 2018-06-08, 17:02

Re: Prevent Google redirect?

Unread post by therube » 2019-01-23, 20:04

If you use NoScript, that does it
That "it" was, NoScript.
And, that "it" was, "prevents google redirects" (aka, cleans up google links).

fillerup

Re: Prevent Google redirect?

Unread post by fillerup » 2019-01-25, 02:43

therube wrote:
If you use NoScript, that does it
That "it" was, NoScript.
And, that "it" was, "prevents google redirects" (aka, cleans up google links).
i do use Noscript and the redirect links appear whether Noscript is allowing google.com or not. in fact if google.com is not allowed to run scripts, the redirect links appear right away when you hover over the mouse and not just when you click the search result, rendering the solutions in this thread useless

Frasier
Lunatic
Lunatic
Posts: 252
Joined: 2014-05-07, 02:44
Location: Indiana

Re: Prevent Google redirect?

Unread post by Frasier » 2019-01-25, 06:09

I'm not seeing what you are:
google_redirect.png
Have no idea why that is. Maybe your location?

fillerup

Re: Prevent Google redirect?

Unread post by fillerup » 2019-01-25, 10:32

Frasier wrote:I'm not seeing what you are:google_redirect.png
Have no idea why that is. Maybe your location?
the redirect link flashes for a brief half a second or so after you click the search result

User avatar
therube
Board Warrior
Board Warrior
Posts: 1651
Joined: 2018-06-08, 17:02

Re: Prevent Google redirect?

Unread post by therube » 2019-01-25, 13:57

i do use Noscript and the redirect links appear whether Noscript is allowing google.com or not.
It's an "aberration".

If, with JavaScript disabled (for google.com), you look (hover) a link, it will (at that instant) show the googlefied (crap) link, but it has actually been cleaned up.
After the first hover, move away, then back, & you should (then) see that it has.
Or if on the first hover, you 'copy link location', you will also see that the copied link is clean.

If, with JavaScript enabled (for google.com) [like who would do that ;-)], the links should show, cleaned, from the get-go.

Frasier
Lunatic
Lunatic
Posts: 252
Joined: 2014-05-07, 02:44
Location: Indiana

Re: Prevent Google redirect?

Unread post by Frasier » 2019-01-25, 14:00

Ah, OK, caught it this try.

Locked