Hacker News new | ask | show | jobs
by spappal 2021 days ago
Firefox supports custom search engines, the most bang for the buck custom search engine must be https://duckduckgo.com/?q=%s with keyword being the letter d. Then you get all these 13000+ bangs without having to configure the custom search engines. E.g. write "d !drive term" in url bar. And "d !w hacker news" sends you directly to https://en.wikipedia.org/wiki/Hacker_News
4 comments

Slightly off-topic but this is an important PSA.

Firefox keyword search has one little known killer feature: You can combine it with data URIs and JavaScript to run small "command line snippets" stored in your bookmarks from your browser bar.

To get started, create a keyword search from any form (like the search bar on duckduckgo.com) and edit the URL of the entry in the bookmark manager to point to

  data:text/html,<script>alert("%s")</script>
instead.

What you can do with this is (fortunately) limited by cross-origin restrictions but there are some useful applications. For example, I use this snippet

  data:text/html,<script>i="%s";firstSep=i.indexOf(" ");if(firstSep==-1)firstSep=i.length;subreddit=i.substr(0,firstSep);searchTerm=i.substr(firstSep+1);location=`https://old.reddit.com/r/${encodeURIComponent(subreddit)}${(searchTerm!=null&&searchTerm.replace(/\s/,"").length>0)?`/search?q=${encodeURIComponent(searchTerm)}&restrict_sr=1`:""}`</script>
as a nice shortcut to Reddit ("<keyword> <subreddit>" to jump to a Subreddit, "<keyword> <subreddit> <search string>" to search within a Subreddit).

You can also insert content directly into the document which opens the possibility for instant marquee

  data:text/html,<marquee>%s</marquee>
Or you just set DDG as your default search engine and then you don't even have to type the "d" anymore. :)
This would be amazing, but gives me '405 - Not Allowed - nginx', see also [0]. Strange.

[0] https://bugzilla.mozilla.org/show_bug.cgi?id=1625901

EDIT: That error occurred when going Right Click -> Add Keyword from the website. If setting the bookmark manually completely, it works.

Or just create a bookmark for https://drive.google.com/drive/search?q=% and type `drive term` or whatever you call it without bouncing through DDG.
This works on every device you own. You don't need to setup anything.

And there are thousands more at duckduckgo.com/bang .