如果您需要与系统不同的扩展,则应构建不带代理的扩展,并在功能中定义代理。
要创建扩展名,只需使用
username和中定义的凭据将以下文件压缩为
password:
manifest.json :
{ "manifest_version": 2, "name": "Authentication for ...", "version": "1.0.0", "permissions": ["<all_urls>", "webRequest", "webRequestBlocking"], "background": { "scripts": ["background.js"] }}
background.js :
var username = "my-username";var password = "my-password";chrome.webRequest.onAuthRequired.addListener( function handler(details) { if (username == null) return {cancel: true}; var authCredentials = {username:username, password: username}; username = password = null; return {authCredentials: authCredentials}; }, {urls: ["<all_urls>"]}, ['blocking']);
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)