Skip to content

Instantly share code, notes, and snippets.

@weirane
Last active January 29, 2020 11:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save weirane/fec4be88acc9d0055b7bf71a81c82710 to your computer and use it in GitHub Desktop.
Save weirane/fec4be88acc9d0055b7bf71a81c82710 to your computer and use it in GitHub Desktop.
A tampermonkey script to disable redirections of Google search results by removing onmousedown event of <a> tags
// ==UserScript==
// @name Remove onmousedown in Google results
// @include https://www.google.*/search?*
// ==/UserScript==
// Much thanks to https://gist.github.com/3081371
(function() {
'use strict';
const disable = (node) => {
const as = node.getElementsByTagName('a');
for (const a of as) {
a.removeAttribute('onmousedown');
}
};
disable(document.body);
// Some <a>s are not treated in the first round
setTimeout(() => disable(document.body), 2000);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment