Chrome扩展程序中的代理 [英] Proxy in Chrome Extension

查看:692
本文介绍了Chrome扩展程序中的代理的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想创建Chrome扩展程序,以更改Chrome的代理设置。
一切正常,但问题是我必须使用用户名和密码与代理进行身份验证。

任何想法如何做到这一点?

  var config = {
mode:fixed_servers,
rules:{
proxyForHttp :{
scheme:https,
主机:209.164.75.72,
端口:9786,
用户名:'myusernmae',
密码:'proxypassword '

},
bypassList:[foobar.com]
}
};
chrome.proxy.settings.set(
{value:config,scope:'regular'},
function(){
console.debug(chrome);

});

上面的代码不起作用,因为这里没有有效的文档如何验证代理
https://developer.chrome.com/extensions/proxy

$ b $您可以监听

> chrome.webRequest.onAuthRequired details.isProxy 为true时提供凭证。您需要 webRequest webRequestBlocking 权限。



这就是 Chrome-proxy-helper 的作用。


I want to create a Chrome Extension wich changes the Proxy Settings of Chrome. Everything works correct but the problem is that i have to authenticate with username and password with the proxy.

Any idea how to do this ?

          var config = {
    mode: "fixed_servers",
    rules: {
      proxyForHttp: {
  scheme: "https",
  host: "209.164.75.72",
  port: 9786,
  username:'myusernmae',
  password:'proxypassword'

      },
      bypassList: ["foobar.com"]
    }
  };
  chrome.proxy.settings.set(
      {value: config, scope: 'regular'},
      function() {
    console.debug(chrome);    

          });

The above code doesnt work as seen here there are no valid documentation how to authenticate the proxy https://developer.chrome.com/extensions/proxy

解决方案

You can listen for chrome.webRequest.onAuthRequired to provide the credentials when details.isProxy is true. You'll need the webRequest and webRequestBlocking permissions.

That's how Chrome-proxy-helper works.

这篇关于Chrome扩展程序中的代理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆