Create an extension that automatically configures Brave Search

If you keep your cookies around you just need to go here and turn on “Anonymous usage metrics” but if you’re like me and like to blow away your cookies every session it can be useful to have an extension that applies the Brave Search settings automatically.

Firefox users: This should work for Firefox but Mozilla doesn’t allow it’s users to permanently load their own extensions unless they’re attached to a Mozilla account. You’ll need to use a Mozilla account to upload your extension to get it signed before use.

Instructions for Chromium-based browsers:

Creating the extension:

mkdir brave-search-auto-set
cd brave-search-auto-set
nano manifest.json
# Paste the following:
{
	"name": "BraveSearchAutoSet",
	"version": "1.0",
	"description": "Change search settings",
	"manifest_version": 2,
	"content_scripts": [
		{
			"matches": ["https://search.brave.com/settings"],
			"js":  ["content.js"]
		}
	]
}
nano content.js
# Paste the following:
(function(){
	// Toggle on "Google fallback mixing"
	// document.getElementsByClassName('form-switch')[2].click()

	// Toggle off "Discussions"
	document.getElementsByClassName('form-switch')[3].click()

	// Toggle on "Anonymous usage metrics"
	document.getElementsByClassName('form-switch')[4].click()

	// Toggle off "Anonymous local results" (triggers a refresh, keep last)
	// document.getElementsByClassName('form-switch')[1].click()

	// Go to this URL after 100 milliseconds
	setTimeout(()=>{window.location.href='https://search.brave.com/'},100)
})()

Launching Brave Search settings on startup:

  • Go to:
    • Chromium browsers: chrome://settings/onStartup
    • Brave browser: brave://settings/getStarted
  • Under On startup, select Open a specific page or set of pages
  • Click Add a new page and enter: https://search.brave.com/settings

Installing the extension:

  • Go to:
    • Chromium browsers: chrome://extensions
    • Brave browser: brave://extensions
  • Turn on Developer mode (top right slider)
  • Click Load unpacked (top left) and select the brave-search-auto-set folder or drag the folder into the window.

Testing:

Close all browser windows and re-launch the browser. It should automatically go to https://search.brave.com/settings, apply the correct settings and go to https://search.brave.com/

Note: Moving the extension folder requires re-installing the extension per the instructions above. If you change the code you need to hit the refresh circle next to the extension in the extension section.

3 Likes