Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've known how to add context-menuitem to firefox.

I frequently toggle Edit->Preferences->Advanced->Network->No Proxy | Manual proxy configuration

I want to add a Proxy ON/OFF to context-menu, it'll help me a lot.
I don't want to install another add-on to do this tiny job.
Is there a quick way? Thanks for your help!

share|improve this question
up vote 2 down vote accepted

If you don't want to install the excellent Toggle Proxy add-on (which gives you a keyboard shortcut and a toolbar button), you can go to the special URL about:config and change the value of network.proxy.type according to this article:

  • 0 - Direct connection, no proxy
  • 1 - Manual proxy configuration
  • 2 - Proxy auto-configuration (PAC)
  • 4 - Auto-detect proxy settings
  • 5 - Use system proxy settings (default on all platforms)

Specifically, it sounds like you will be toggling between 5 and 0.

share|improve this answer
    
Thanks for your help! – kev May 8 '12 at 4:09

As what I did in how to add context-menuitem to firefox.
I've added Toggle Proxy:

<!-- TOGGLE-PROXY BEGIN -->
      <menuitem id="context-toggle-proxy"
                label="Toggle Proxy"
                oncommand="gPrefService.setIntPref('network.proxy.type', !gPrefService.getIntPref('network.proxy.type'));"/>
<!-- TOGGLE-PROXY END -->

Currently, I'm working on how to display Proxy ON/Proxy OFF depending on current proxy setting.
If you have any idea, please let me known.

Caution:

You should enable/disable an add-on to reload omni.ja.
Because I've wasted one hour on this.

share|improve this answer
    
Note that !gPrefService.getIntPref('network.proxy.type') will toggle Boolean values, which probably get cast to 0 and 1. It's probably better to use (gPrefService.getIntPref('network.proxy.type') == 0) ? 1 : 0, the ternary operator. The 1 you should use to specify the type when proxy is on, as in Alex's answer. – Bob May 8 '12 at 5:10

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .