Skip to content

Instantly share code, notes, and snippets.

@kevinleedrum
Last active July 6, 2023 15:24
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 kevinleedrum/4d286da27e63a0eb7e17a36ed2ddd4e8 to your computer and use it in GitHub Desktop.
Save kevinleedrum/4d286da27e63a0eb7e17a36ed2ddd4e8 to your computer and use it in GitHub Desktop.
Replace Google Links with DuckDuckGo Links
// ==UserScript==
// @name Replace Google links with DuckDuckGo links
// @namespace https://gist.github.com/kevinleedrum/4d286da27e63a0eb7e17a36ed2ddd4e8
// @version 0.1
// @description Replace Google links on the page with DuckDuckGo links
// @author You
// @match https://*/*
// @exclude https://*google.com/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=duckduckgo.com
// @grant none
// ==/UserScript==
(function() {
const googleLinks = document.querySelectorAll('a[href^="https://www.google.com/search"]');
googleLinks.forEach(link => {
const newUrl = link.href.replace('https://www.google.com/search', 'https://duckduckgo.com');
link.innerText = link.innerText.replace('Google', 'DuckDuckGo');
link.setAttribute('href', newUrl);
});
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment