How do I use a proxy in my extension?

  • 0
    As far as I know, the extension APIs allow you to locally apply one or another proxy in the browser. Maybe I'm asking a lot, but could anyone give an example of how this is done? Sample code to change browser proxy.

    I'm only interested in the Google Chrome browser. If you suddenly think that I am a little swollen with such requests, then you can send me away, read the documentation, I will understand and not be offended) Just give me a link, otherwise all my attempts at googling give out ready-made extensions, and not instructions, as in extension change proxy.
    JavaScript Anonymous, Jan 28, 2020

  • 1 Answers
  • 0
    Yes, the actual examples in the documentation are enough:

    Example of installing Socks5 proxy for all sites except foobar.com

    var config = {
    mode: "fixed_servers",
    rules: {
    proxyForHttp: {
    scheme: "socks5",
    host: "1.2.3.4"
    },
    bypassList: ["foobar.com"]
    }
    };
    chrome.proxy.settings.set(
    {value: config, scope: 'regular'},
    function() {});




    Here is the office. example extension.
    Anonymous

Your Answer
To place the code, please use CodePen or similar tool. Thanks you!