Rechercher dans l’assistance

Évitez les escroqueries à l’assistance. Nous ne vous demanderons jamais d’appeler ou d’envoyer un SMS à un numéro de téléphone ou de partager des informations personnelles. Veuillez signaler toute activité suspecte en utilisant l’option « Signaler un abus ».

Learn More

Force search engine in mozilla.cfg?

  • 10 réponses
  • 9 ont ce problème
  • 368 vues
  • Dernière réponse par E Almonte

more options

How can I lock the search to Google using mozilla.cfg on Firefox 44?

Based on searching, I've tried the following settings:

lockPref("", false); lockPref("", "Google"); lockPref("", "Google"); lockPref("", "Google");

And both variations of: lockPref("","data:text/plain,"); lockPref("","data:text/plain,");

lockPref("", "Google"); lockPref("", "Google");

Nothing seems to work.

Toutes les réponses (10)

more options

The data:text/plain variant is only required to set the default value of a pref via defaultPref(); In all other cases you can use the plain value.

You can no longer set the default search engine via a pref similar to setting the new tab page (browser.newtab.url)

  • bug 1029148 - store "current search engine" configuration outside of prefs

Please do not comment in bug reports

The setting of the current default search engine is stored in the search-metadata.json file in the Firefox profile folder in the [global] section.

current: "";
searchdefault: "Google";
more options

Solution choisie

Modifié le par cor-el

more options

Thank you for your reply.

So best practice is to set the currentEngine property using javascript in the mozilla.cfg? (was unaware it was parsed in that fashion.)

Far less intuitive, but it will do.

more options

For anyone else who has this issue:

In mozilla.cfg this following will set Google as the default. Users can still change it, but it will change back upon next start of Firefox.

Components.utils.import("resource://gre/modules/Services.jsm"); var searchService =; var engine = searchService.getEngineByName("Google"); searchService.currentEngine = engine;

more options

Note that for the about:newtab page you need to use a similar way to do this.

more options

This seems to work consistently, at least on Firefox 45 ESR:

local-settings.js file:

// //

pref("general.config.obscure_value", 0); //do not obscure content with ROT-13 cipher pref("general.config.filename", "mozilla.cfg"); //use the mozilla config file for further preferences

Add to mozilla.cfg file

// Change default search engine to Google lockPref("", "US"); lockPref("", "US"); lockPref("", "Google"); lockPref("", "Google");

more options

That likely won't work anymore. Current releases store this data in search.json.mozlz4 and prefs are no longer being used.

more options

Good to know, and I will have to research another method for the future when it no longer works for Firefox ESR.

Preferences definitely work on Firefox 45.1.0 ESR english release as per my prior post... I have not tested on the general release.

I am pushing it out to about 75 computers right now and I verified that the settings persisted on normal user logins as well as under an administrator login.

I obtained the preferences by comparing the default preferences under about:cofig with preferences after the user changes the default search engine under about:preferences#search

SigmaTech said

This seems to work consistently, at least on Firefox 45 ESR:

local-settings.js file:
pref("general.config.obscure_value", 0); //do not obscure content with ROT-13 cipher
pref("general.config.filename", "mozilla.cfg"); //use the mozilla config file for further preferences

Add to mozilla.cfg file

// Change default search engine to Google
lockPref("", "US");
lockPref("", "US");
lockPref("", "Google");
lockPref("", "Google");
more options

This method seems to no longer work in Firefox 47.0.1. And it seems that the search settings are stored in a compressed file (search.json.mozl4z) that's uneditable? Come on, man! Why is it that this stuff is so hard to configure and control? Why are settings just randomly moved and changed every few versions and there is virtually NO documentation on how to manage these new or changed settings for enterprise customers who want some level of control over the browser...

My request is very simple, I just want the browser's default setting to be Google but Mozilla has decided, probably through some financial arrangement with Yahoo, that IT will be the default search engine... the settings above seem reasonable but do NOT WORK which means that there must be some new way of controlling them...

I already tried just copying the compressed file (search.json.*) to the program files folder (/browser/defaults/profile) but it doesn't work... what's interesting is that it DOES work if the profile already exists and I copy the file to the already existent profile folder...

I am really frustrated by this... anyone who has a method of doing this, can you please provide a working set of instructions or settings? We do not want to mandate Google as the search engine, just make it the default on first launch.

Thanks, jcl

more options


I spent about 5 hours trying to figure this out before I got to my solution, playing with all the variations of settings, even settings from the mozilla official page that describes every configuration value and what it does, etc.

I won't comment as to why they made it so hard for people to customize the firefox search engine for deployments now that Yahoo was the sponsor, it's just weird that all of a sudden after they sponsored them it was not as easy as setting a lockPref setting and done.. supposedly it was for security and vulnerability reasons that prevents search engine hijacking.. oh well.

Ok so here is the solution:

I read that search.xml is inside this folder somewhere called search plugins, but that folder is not present in the same location as before, it is now inside a file called omni.ja within the Resources/browser folder. This file cannot just be unzipped because you might run into errors, mozilla even recommends a certain unzip tool for it if you use Windows OS. I even tried Keka to unzip it and it wouldn't, don't know why a Mac built-in Linux version was able to unzip it and inflate the file if needed pretty easily.

Anyway, so what you do is take the omni.ja file, copy it to a new folder somewhere in your desktop, open up terminal and work from within that directory (cd /folder/etc..), then rename that file to or add the .zip so that the system sees it as a zip file.

Then, at the terminal and within the directory of the or file, type: unzip

Then, find the folder: chrome/en-US/locale/browser/searchplugins/

In that folder you should see all the search engines listed:


You can obviously guess what comes next, delete ALL the files except list.txt and google.xml, and open list.txt and also remove all the references of search engines except the google one.


Now to zip the file again back to omni.ja the proper way.

Delete the or file you copied because when you run the zipping command it will create the new file and you dont want to deal with dumb overwrite errors.

In the terminal type in: zip -qr9XD omni.ja *

This will create the file again with all folders and files in their proper way/order.

Now, with the new omni.ja file created, go into your Resources/browser folder and add the word .bak to your default/original omni.ja file that came with Firefox, so your original will be omni.ja.bak just in case anything went wrong and you have to do it again.

Now, copy that new omni.ja file to that directory and voila, Google is not only the default search engine, but there is no other engine to be changed to or able to select.

For reference, I used:

You're welcome.