Akbar
Akbar

Reputation: 1499

How to enable/disable forefox addon using javascript

I want to enable the addon which is disabled manually after firefox restart .I can listen the events for enable/disable firefox addon with the methods "onDisabling: function(addon, needsRestart)" .Can I enable the extension using javascript.any ideas would be appreciated?

Upvotes: 1

Views: 352

Answers (1)

Wladimir Palant
Wladimir Palant

Reputation: 57691

You can use Add-on Manager API for this. Something along these lines:

Components.utils.import("resource://gre/modules/AddonManager.jsm");
AddonManager.getAddonByID("[email protected]", function(addon)
{
  if (addon.userDisabled)
    addon.userDisabled = false;
});

Here [email protected] stands for the ID of the add-on you want to enable of course.

Upvotes: 2

Related Questions