How do I change GeckoFx proxy settings?

2019-07-25 01:49发布

问题:

I'm using GeckoFx version 1.9.1.0, Mozilla XULRunner version 12.0.

回答1:

Help With Proxy Username & Pass with GeckoFX? See this answer for setting proxies programmatically. You can save and load the preferences to a file using the methods GeckoPreferences.Save(string fileName) and GeckoPreferences.Load(string fileName)

With XULRunner 12, you can't store preferences until you create any apps using XULRunner (see this: https://developer.mozilla.org/en-US/docs/Mozilla/Preferences/A_brief_guide_to_Mozilla_preferences)

To insert proxy settings manually in the xulrunner default profile:(XULRunner ~1.9)

Goto d:\path\to\xulrunner\defaults\pref

Open the xulrunner.js, add the preferences you'd like to put.

Now, you can add preferences by following the below sample call at the end of the file:

pref("network.proxy.http", "web-proxy.domain.com");
pref("network.proxy.http_port", 8080);
pref("network.proxy.type", 1);

If you don't know what are the exact preferences or you want to know all the preferences, using your GeckoWebBrowser, navigate to about:config.

For example: geckoWebWebBrowser.Navigate("about:config");.

If the browser tells "This'll Void Warranty", click "I understand ..". Now, you can see all the preferences listed.