Duckduck go button on google

Okay so i have a addon that gives me a google logo i can press to try my search in google if i cant find something on duckduck go but i would like to have the opposite too so a button that would let me click to search on duckduck if googleing isn't successful eg. If someone sends me a google search link

21 points · 3 comments · view on lemmy.world

3 Comments

Zeus@lemm.ee · 11 pts · 3y

this seems like something best solved with a bookmarklet

let me see if i can knock one up quickly


okay, i got a bit distracted, sorry it took so long

javascript:(function() {window.location="https://duckduckgo.com/?"+window.location.toString().match(/q=.*?(\&|$)/g);})()

::: spoiler alternative code block

javascript:(function() {window.location="https://duckduckgo.com/?"+window.location.toString().match(/q=.*?(\&|$)/g);})()

:::

just drag that into your bookmarks bar, then click it when you're on a google search page (please message me with any questions or bugs, i wrote this in five minutes with an online regex tester)

also, thank you for this post - i'd never thought of doing this, but it's a good idea


edit 2: okay, lemmy-ui currently has a bug with ampersands. please replace & in the script with just an "&"

Justly0250@lemdro.id · 1 pts · 3y (1 reply)

Swift Selection Search is an extension that adds search engine buttons on selected text.

I don't think this is exactly what you are looking for, but I guess it has a similar use. I just discovered it last week.

Oliper202020@discuss.tchncs.de · 1 pts · 3y

I have looked at it and some similar, but they are non customisable and i don't like that