title: How can I change Firefox's proxy settings from an external program?
body: <p>I've seen a few programs (eg Charles Web Developer Proxy) that are able to modify Firefox's proxy settings. The sequence is:</p>
  
  <ol>
  <li>Firefox is running, with the users proxy settings.</li>
  <li>User starts the external third party application, which</li>
  <li>modifies Firefox's proxy settings, and then</li>
  <li>the user exits the third party program and,</li>
  <li>Firefox resumes running with its original proxy settings.</li>
  </ol>
  
  <p>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.</p>
  
  <p><strong>Options Considered:</strong></p>
  
  <ul>
  <li>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.</li>
  <li>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.</li>
  </ul>
  
  <p><strong>Possible Resources</strong></p>
  
  <ul>
  <li>Programatically changing Firefox preferences: <a href="https://developer.mozilla.org/en/Code_snippets/Preferences" rel="noreferrer">Preferences - MDC</a></li>
  <li>Building Firefox Extensions: <a href="https://developer.mozilla.org/en/Extensions" rel="noreferrer">Extensions - MDC</a></li>
  </ul>