Skip to content

Instantly share code, notes, and snippets.

@jackiig
Created April 8, 2020 15:29
Show Gist options
  • Select an option

  • Save jackiig/5edbc90ba151d56c539fff8010c018bb to your computer and use it in GitHub Desktop.

Select an option

Save jackiig/5edbc90ba151d56c539fff8010c018bb to your computer and use it in GitHub Desktop.
Bookmarklet for quickly switching from DuckDuckGo to Google.
// Create a bookmark in your browser(s), and use the Javascript below as the "URL" portion of the bookmark.
// This use of Javascript in a bookmark is called a "Bookmarklet".
// Set your default search engine to DuckDuckGo: https://duckduckgo.com/install
// If you find you're not getting the results you want, click the Bookmarklet.
javascript:window.location = window.location.toString().replace('duckduckgo.com/', 'google.com/search');
@magasine
Copy link

magasine commented Sep 2, 2022

This a toggle option:

javascript: (function () {
   var loc = location.href;
   loc =
      loc.indexOf("google.com/search") != -1
         ? loc.replace("google.com/search", "duckduckgo.com/")
         : loc.replace("duckduckgo.com/", "google.com/search");
   location = loc;
})();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment