Search Support

Avoid support scams. We will never ask you to call or text a phone number or share personal information. Please report suspicious activity using the “Report Abuse” option.

Learn More

This thread was closed and archived. Please ask a new question if you need help.

How to change settings or preferences in firefox source code?

  • 6 பதிலளிப்புகள்
  • 1 இந்த பிரச்சனை உள்ளது
  • 52 views
  • Last reply by cor-el

I want to change some settings in Firefox from the source code, and I cant figure It out. I Have Heard Of autoconfig but that's for in the directory of Firefox.

I want to change some settings in Firefox from the source code, and I cant figure It out. I Have Heard Of autoconfig but that's for in the directory of Firefox.

All Replies (6)

Hi

If you are looking to work with the code of Firefox, this site will help you to get started:

https://firefox-source-docs.mozilla.org/index.html

I have done all of those already, But I want the change the default preferences in firefox.

There is no need to edit the source code to change the default value of a pref. You can do this via a policies.json file or via autoconfig.cfg file in case the pref is not supported by a policy.


To use Autoconfig, place two files into the Firefox installation directory.

  • on Windows, they go into the same directory where Firefox is installed
  • on macOS, they go into the Contents/Resources directory of the Firefox.app

The autoconfig.js file that specifies to use autoconfig.cfg is placed into the "defaults\pref" directory where the channel-prefs.js file is located. The autoconfig.cfg file is placed at the top level of the Firefox directory.

  • autoconfig.cfg and autoconfig.js need to start with a comment line (//)
  • autoconfig.js needs to use Unix line endings (LF instead of CR/LF)

The content of autoconfig.js:

//
pref("general.config.filename", "autoconfig.cfg");
pref("general.config.obscure_value", 0);
pref("general.config.sandbox_enabled", false);

These functions can be used in autoconfig.cfg:

defaultPref();	// set new default value, requires special data: format for localized prefs
pref();	// set pref, allow changes in current session
lockPref();	// lock pref, disallow changes

But i want it to be defaulted so when i build it it always has those settings without having to put these files

I have built firefox using mozillabuild but I want the change the default settings or preferences, for example the homepage or more preferences page. I want to do this directly from the code.

I will lock this thread since you decided to create a new thread.