Skip to content

Instantly share code, notes, and snippets.

@phiSgr
Last active May 5, 2021 20:37
Show Gist options
  • Save phiSgr/a12a386de24307720b333cdfda43e4fd to your computer and use it in GitHub Desktop.
Save phiSgr/a12a386de24307720b333cdfda43e4fd to your computer and use it in GitHub Desktop.
Remove one off searches in URL bar in Firefox

This no longer works because of the code change. I have given up fighiting it.


The misery of having one-off searches in URL bar comes from a file in a "zip" file omni.ja.

To disable the feature we can edit the file, with the risk of rendering Firefox unusable.


Make a backup of the file first.

cd /Applications/Firefox.app/Contents/Resources/browser/
cp omni.ja omni.ja_backup

Unzip the file and edit

cd ~/temp
cp /Applications/Firefox.app/Contents/Resources/browser/omni.ja .
unzip omni.ja
rm omni.ja
vi modules/SearchOneOffs.jsm
// we add a flag to see whether it is from URL bar or search bar
  constructor(container) {
    this.container = container;
this.noOp = container.parentElement.classList.contains("urlbarView");
    this.container.appendChild(

...
// and return an empty list for search engines when it is in URL bar
  async getEngines() {
if (this.noOp) { return []; }
    if (this._engines) {
      return this._engines;
    }

And repack and overwrite

zip -qr9XD omni.ja *
cp omni.ja /Applications/Firefox.app//Contents/Resources/browser/omni.ja

Finally, purge the caches for our hack to take effect.

/Applications/Firefox.app/Contents/MacOS/firefox-bin -purgecaches

The above is done in MacOS and on Firefox 81.0. For earlier versions that file is in chrome/browser/content/browser/search/search-one-offs.js. The same change should work on Linux and Windows as well, but I am not sure about the file locations and the commands to use. Feel free to comment below.

I'm not taking responsibilities if you break any stuff.

@Vallek
Copy link

Vallek commented Nov 21, 2020

Hi! I'm trying to do this on Windows through total commander/code editor. And it won't allow me to rewrite file. Is it different on Mac? Do you think it's windows problem or i should do it with cmd?

@phiSgr
Copy link
Author

phiSgr commented Nov 21, 2020

Probably you should ask this question on stack overflow/stack exchange with all your commands and error messages.

@Vallek
Copy link

Vallek commented Nov 21, 2020

Ok I opened your mdn link (which i should to begin with:) I think it's because you can only repack it with right options (zip -0DXqr omni.ja). Problem is there is no zip program in cmd, so i have to install it for PATH or something.

@Vallek
Copy link

Vallek commented Nov 21, 2020

Ok I managed to repack it! Could you please explain where exactly the code goes? I found the first part in the beginning. But what about second part?
upd: Forget it found other way https://www.reddit.com/r/firefox/comments/k03coh/how_to_really_remove_oneoffs_search_engines/

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