我正在尝试构建一个 chrome 扩展,它可以在启动浏览器时更改代理设置。我遵循了 chrome 扩展文档,但仍然没有成功。
清单.json
{
"manifest_version": 2,
"name": "Proxy",
"description": "Proxy on 127.0.0.1:8080",
"version": "1.1",
"background": {
"scripts":["background.js"]
},
"browser_action": {
"default_icon": "icon.png",
"popup":"popup.html"
},
"permissions": [
"tabs",
"http://*/*",
"https://*/*",
"notifications",
"contextMenus",
"history",
"background",
"proxy"
],
"content_security_policy": "script-src 'self' 'unsafe-eval'; object-src 'self'"
}
背景.js
chrome.windows.onCreated.addListener(function() {
var config = {
mode: "fixed_servers",
rules: {
proxyForHttp: {
scheme: "http",
host: "127.0.0.1",
port:"8080"
},
bypassList: ["foobar.com"]
}
};
chrome.proxy.settings.set(
{value: config, scope: 'regular'},
function() {});
});
上面的代码不起作用...