Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I change Firefox's proxy settings from an external program?

Tags:

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

  • Programatically changing Firefox preferences: Preferences - MDC
  • Building Firefox Extensions: Extensions - MDC