Chrome扩展程序中的代理 [英] Proxy in Chrome Extension
问题描述
我想创建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
> 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屋!