I can not change firefox proxy via the code below:
var scope = {};
Components.utils.import("resource://imacros/utils.js", scope);
Components.utils.import("resource://imacros/rijndael.js", scope);
Components.utils.import("resource://gre/modules/ctypes.jsm", scope);
var __loginf = scope.__loginf;
var imns = scope.imns;
var pref = imns.prefsvc.getBranch("network.proxy.");
pref.setCharPref("http", server);
pref.setIntPref("http_port", port);
pref.setCharPref("ssl", server);
pref.setIntPref("ssl_port", port);
pref.setIntPref("type", 1);
Help me please.
You should definitely be using the addon-sdk. Here's a link to their docs for the preferences service where you can find more info.
Here's what a solution could look like using the addon-sdk.
var prefsvc = require("sdk/preferences/service");
prefsvc.set("network.proxy.http", server);
prefsvc.set("network.proxy.http_port", port);
prefsvc.set("network.proxy.ssl", server);
prefsvc.set("network.proxy.ssl_port", port);
prefsvc.set("network.proxy.type", 1);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With