Disable Certain Firefox Plugins System-wide by Default

firefox

I have firefox installed system-wide for all our users. Unfortunately the Adobe Reader Plug-in is rather flakey and doesn't work some of the time. As a result I want to disable the plug-in by default for all our users, but still allow them to enable it if they want via the standard Tools->Add-ons->Plug-ins menu option. How can I have this plug-ins enabled/disabled status be disabled by default?

I've been able to configure system-wide configurations before by setting preferences in the mozilla root folder file defaults/pref/all.js, but enabled/disabled plugins doesn't appear to be configured in the preferences.

[edit 1]: I found 'How to manage firefox plugins in pluginreg.dat file' which explained some of the formatting of the pluginreg.dat file. From there I could see flags are masked as follows (from nsPluginHostImpl.h):

#define NS_PLUGIN_FLAG_ENABLED 0x0001 // is this plugin enabled?
#define NS_PLUGIN_FLAG_OLDSCHOOL 0x0002 // is this a pre-xpcom plugin?
#define NS_PLUGIN_FLAG_FROMCACHE 0x0004 // this plugintag info was loaded from cache
#define NS_PLUGIN_FLAG_UNWANTED 0x0008 // this is an unwanted plugin
#define NS_PLUGIN_FLAG_BLOCKLISTED 0x0010 // this is a blocklisted plugin

But is there a way to add this to the defaults so that that NS_PLUGIN_FLAG_ENABLED is removed by default?

Best Answer

The plugins' settings are now integrated partially in about:config as of Firefox 22, and fully in 23+. The key names are plugin.state.* where * denotes the internal naming scheme used by Firefox for the discovered plugins. The values (integer) are 0 for disabled (Never Activate in Firefox Tools (Alt + T) > Add-ons > Plugins), 1 for click-to-play (Ask to Activate), and 2 for enabled (Always Activate). Firefox 22 has 0 and 2, and 23+ includes all the three states. The state Ask to Activate (1) is triggered after toggling plugins.click_to_play to true in about:config.

One way to get the correct names used by Firefox is from a reference/IT PC. Toggle the default states of all the discovered plugins (Firefox Tools (Alt + T) > Add-ons > Plugins) once, to reveal the corresponding plugin.state.* keys in about:config.

Using the lock (policy) file, defaultPref() or pref() can be used to set an initial preference i.e. nonmandatory - users may later change the initially set state of the plugin -, while lockPref() can be used to set a policy i.e mandatory - users cannot change the state.

e.g. defaultPref("plugin.state.flash", 0); to set an initial disabled state for the Flash plugin which users may change, or lockPref("plugin.state.flash", 0); to lock the state.

To also include Ask to Activate (1):

defaultPref("plugins.click_to_play", true); OR lockPref("plugins.click_to_play", true);
defaultPref("plugin.state.flash", 1);

about:config Entries, Config Descriptions addon