谷歌插件 浏览器请求添加固定的header
总所周知中国的个人银行的网站安装了插件
- 主要收集 ip mac 等信息 发到header
- 只能用IE、360等插件才可以登陆
写一个谷歌插件可以修改header就可以使用心爱的谷歌
{
"name": "Header Extensions",
"description": "Header Level Extension",
"version": "1.0",
"manifest_version": 2,
"permissions": [
"webRequest",
"webRequestBlocking",
"https://*/*",
"http://*/*"
],
"background": {
"scripts": ["background.js"]
},
"browser_action": {
"default_icon": "popup.png"
}
}
'use strict'
function addHeader (headers) {
headers.push({ name: 'dummyHeader', value: '1' })
}
chrome.webRequest.onBeforeSendHeaders.addListener(function (details) {
addHeader(details.requestHeaders)
return { requestHeaders: details.requestHeaders }
},
{ urls: ['https://*/*', 'http://*/*'] }, ['blocking', 'requestHeaders', 'extraHeaders'])
chrome.webRequest.onHeadersReceived.addListener(function (details) {
addHeader(details.responseHeaders)
return { responseHeaders: details.responseHeaders }
}, { urls: ['https://*/*', 'http://*/*'] }, ['blocking', 'responseHeaders', 'extraHeaders'])
本文来自博客园,作者:vx_guanchaoguo0,转载请注明原文链接:https://www.cnblogs.com/guanchaoguo/p/16365798.html