Chrome extension access webrequest headers -
i'm trying write simple extension deed on request headers.
in documentation there chrome.webrequest
, have no thought how create work....
when set listener content page, chrome.webrequest
undefined, when set background section, totally nil happens...
manifest
{ "manifest_version": 2, "name": "requestspy", "version": "0.1", "description": "http/s request analizer", "background": [ { "scripts": ["scripts.js"] } ], "icons":{ "128":"spy.png" }, "permissions": [ "*://*/*","webrequest" ] }
script.js
alert('haha'); chrome.webrequest.onheadersreceived.addlistener(function(details){ console.log(details); alert('huhu'); });
any help?
manifest.json
{ "name": "onrequest", "version": "1.0", "description": "i can't has cheezburger!", "permissions": ["webrequest", "webrequestblocking", "http://*/*", "https://*/*"], "background": { "scripts": ["background.js"] }, "manifest_version": 2 }
background.js
chrome.webrequest.onheadersreceived.addlistener(function(e){ alert("onheadersreceived");},{urls: ["http://*/*", "https://*/*"]}, ["blocking"] );
google-chrome google-chrome-extension
No comments:
Post a Comment