如何从外部程序更改Firefox的代理设置? [英] How can I change Firefox's proxy settings from an external program?

查看:242
本文介绍了如何从外部程序更改Firefox的代理设置?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我见过一些能够修改Firefox代理设置的程序(例如Charles Web Developer Proxy)。顺序是:


  1. Firefox正在运行,用户代理设置。

  2. 用户启动外部第三方应用程序,其中
  3. 修改了Firefox的代理设置,然后用户退出第三方程序,然后
  4. $ b
  5. Firefox继续以原始代理设置运行。

假设外部应用程序正在记住旧代理设置并将其还原退出时如何读取和写入Firefox的代理设置?已经尝试通过Firefox搜索谷歌搜索,但没有运气。



选项考虑:




  • 编写新的用户首选项配置文件并启动浏览器的新实例。可以工作,但不是很对 - 查尔斯例如可以修改已经运行的浏览器的设置,并恢复它们,而无需重新启动。

  • 编写一个插件。可以编写一个Firefox插件,向外部提供某种类型的IPC,然后处理自己的Firefox偏好设置。事实上,我认为这可能是唯一的方法。禁用Charles的Firefox插件似乎禁用了即时修改首选项的功能。



可能的资源




解决方案

,查尔斯有一个匹配的Firefox扩展它安装/使用。这可能是它可以如何重新加载代理信息。代理信息存储在配置文件的prefs.js中,但不能在运行中重新加载。 Firefox在启动时从中读取,并在关闭时写入,而不在中间加载。另外,如果Firefox在编辑prefs.js时运行,您的更改将被覆盖。



我以为你可以用PAC文件做一些事情,挖了一下,我发现它似乎也没有被重新加载。您必须重新启动以重新加载对设置的任何修改。


I've seen a few programs (eg Charles Web Developer Proxy) that are able to modify Firefox's proxy settings. The sequence is:

  1. Firefox is running, with the users proxy settings.
  2. User starts the external third party application, which
  3. modifies Firefox's proxy settings, and then
  4. the user exits the third party program and,
  5. Firefox resumes running with its original proxy settings.

Assuming the external application is remembering the old proxy settings and restoring them on exit how can I read and write Firefox's proxy settings? Have tried Googling through the Firefox doco but no luck yet.

Options Considered:

  • Write a new user preferences config file and start a new instance of the browser. Would work but not quite right -- Charles for example can modify the settings of an already running browser and restore them without restarting.
  • Write a plug-in. Could write a Firefox plugin that offered some kind of IPC to the outside and then handled the Firefox preference setting itself. In fact, I think this might be the only way. Disabling Charles' Firefox plug-in seems to disable its ability to modify preferences on the fly.

Possible Resources

解决方案

From what I could see from the documentation, Charles has a matching Firefox extension which it installs/uses. That may be how it can reload the proxy information on the fly.

Proxy information is stored in your profile's prefs.js, but that can't be reloaded on the fly. Firefox reads from it on startup and writes to it when it shuts down, and does not load from it in between. Also, if Firefox is running when you edit prefs.js, your changes will be overwritten.

I thought you might be able to do something with a PAC file, but after digging around a bit, I've found that it doesn't seem to be reloaded on the fly either. You'd have to restart to reload any modifications to the settings.

这篇关于如何从外部程序更改Firefox的代理设置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆