Forked from k-barton/remove-google-tracking.user.js
Last active
July 29, 2023 03:45
-
-
Save tomac4t/ebd83d9b9affeae0875874a54798e7d9 to your computer and use it in GitHub Desktop.
Greasemonkey user script: Remove Google's link tracking
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Remove Google's link tracking | |
// @description Removes onmousedown event from external Google links to allow direct links | |
// @namespace https://gist.github.com/k-barton | |
// @include https://www.google.com/search* | |
// @version 0.2.0 | |
// @grant unsafeWindow | |
// @run-at document-end | |
// ==/UserScript== | |
(function () { | |
var fix_link = (el) => { | |
if (el.href.indexOf('www.google.') === -1) { | |
el.removeAttribute('onmousedown'); | |
el.removeAttribute('ping'); | |
el.setAttribute("target", "_blank"); | |
el.setAttribute("rel", "noopener noreferrer"); | |
} | |
}; | |
var n = document.links.length; | |
for (let i = 0; i < n; i++) { | |
fix_link(document.links[i]); | |
}; | |
}).apply(null); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment