搜索 | 用户支持

防范以用户支持为名的诈骗。我们绝对不会要求您拨打电话或发送短信,及提供任何个人信息。请使用“举报滥用”选项报告涉及违规的行为。

Learn More

Is there a temporary equivalent of user.js?

  • 3 个回答
  • 0 人有此问题
  • 25 次查看
  • 最后回复者为 cor-el

more options

Preferences in user.js are added permanently to prefs.js and persist even after user.js is deleted. What if you want to specify preferences in a file, just like with user.js, but you don't want them to be made permanent? In other words, so that when the file is deleted, the prefs will be forgotten. Is there any way to do this?

Preferences in user.js are added permanently to prefs.js and persist even after user.js is deleted. What if you want to specify preferences in a file, just like with user.js, but you don't want them to be made permanent? In other words, so that when the file is deleted, the prefs will be forgotten. Is there any way to do this?

所有回复 (3)

more options

No, user.js is processed each time you launch Firefox and this means that changes you make only last in the current session. Changes from the default are stored prefs.js and you need to reset involved prefs on about:config or edit prefs.js to undo those changes.

A possible alternative is using an autoconfig.cfg file in the Firefox installation folder as that allows to redefine the default value (defaultPref(prefName, value)) what makes Firefox not store redefined value as this pref doesn't appear bold on about:config.

有帮助吗?

more options

Thanks for your reply, cor-el. I'm not sure if autoconfig offers a solution, though. If I put prefs into that file and then later delete that file, will those prefs persist? Or be lost? (I'm looking for a solution where the prefs would be lost after the prefs file is deleted.)

有帮助吗?

more options

If you want to disable autoconfig.cfg, then you need to remove or rename the "defaults\pref\autoconfig.js" file (remove the .js file extension as that is what matters) that specifies using autoconfig and not simply only remove autoconfig,cfg or you get an error when you start Firefox.

What I wrote above is to modify the default value of a pref and as long as you do not change this value from the default what makes it stored in prefs.js, then the pref will get its original default value if you disable autoconfig. If you make changes, then you keep those changes on following starts unlike with user.js that resets the pref to the value set via user.js. With autoconfig you can also do this if you use a pref() call pref(prefName, value) and not defaultPref() like you can read in the article. Autocofig works for all profiles as this file is stored in the installation folder.


You can use the autoconfig.cfg file in the Firefox installation folder to initialize (set/lock) preferences and run privileged JavaScript code.

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), so use an editor like Notepad++ that can handle this

See also:


Content of autoconfig.js:

// start autoconfig.js with a comment line 
pref("general.config.filename", "autoconfig.cfg");
pref("general.config.obscure_value", 0);

Content of autoconfig.cfg:

// start autoconfig.cfg with a comment line

有帮助吗?

我要提问

您需要登录才能回复。如果您还没账号,可以提出新问题