This site will have limited functionality while we undergo maintenance to improve your experience. If an article doesn't solve your issue and you want to ask a question, we have our support community waiting to help you at @FirefoxSupport on Twitter and/r/firefox on Reddit.

Search Support

Avoid support scams. We will never ask you to call or text a phone number or share personal information. Please report suspicious activity using the “Report Abuse” option.

Learn More

How can I set a different proxy server for different networks in user.js

  • 1 reply
  • 2 have this problem
  • 1 view
  • Last reply by cor-el

more options

I need to automatically set the proxy configuration depending on the network I am connected to. Can this be done through the user.js?

Simple logic would be:-

if IP=10.20.30.0 use proxy A if IP=172.18.19.0 use proxy B else DIRECT

Thanks

Leon

I need to automatically set the proxy configuration depending on the network I am connected to. Can this be done through the user.js? Simple logic would be:- if IP=10.20.30.0 use proxy A if IP=172.18.19.0 use proxy B else DIRECT Thanks Leon

Modified by leonc

All Replies (1)

more options

No, you can't do it that way.

You could create a set of files user.js and use a bat or cmd file to copy the file with the proxy setting that you want to use to user.js and then start Firefox.

cd <path to profile folder>
delete user.js
copy user-proxy1.js user.js
start "" "C:\Program Files\Mozilla Firefox\firefox.exe"


You can also use an extension.