1 at the moment I mastered the debugging skills is very inconvenient, now using the browser action, each time you need to click on the popup page pop-up, and then right-to view the element, the ability to display its debug panel. One click and it's gone;
2 Change the value of the response header, actually in the Web page debugging tool on the network panel will not change, that is, can not feedback out, but the actual use of hair now, has changed, in the popup plugin debug panel output value can also see is changed, this is very depressed;
3 For example, the Onheadersreceived event, which defaults to the details of the Responseheaders attribute is not included, assuming the need to be added to the third part of the AddListener, and this parameter is not scrambled, assuming that the chaos added, It will output the JS error prompt on the popup debug panel, saying that this parameter is for this on event, just agree to what the number of parameters. As I arbitrarily add a ["RESPONSEHEADERSD", "blocking"], it is to mention the demo sample such as the following: uncaught Error:invalid value for argument 2. Property '. 0 ': Value must is one of: [Blocking, Responseheaders]. Since I've written a D, it's good to write a mistake if you don't know what you're going to get here.
, can see that it can open two debug panels, one is the popup, and one is the current page; If you change the code, directly F5 the popup debugger will load, do not need to go back to the plug-in management that press Ctrl_+r
4 give all the response URL plus a cross-domain request to agree to all the domain name of the head, such as, you want to test some JS function. Use cross-domain requests, but not easy to change the other side of the data, then you can use this plugin to deal with. Let the browser take its domain name content as your own, any use it.
Chrome.webRequest.onHeadersReceived.addListener (function (details) {
Details.responseHeaders.push ({name: ' Access-control-allow-origin ', Value: "*"});
Console.log (Details.responseheaders)
return {responseHeaders:details.responseHeaders};
},{urls: ["<all_urls>"]}, ["Responseheaders", "blocking"]);
The following look at the use of this plugin processed Baidu return content, can be used arbitrarily, no longer output cross-domain no permissions error
about using the chrome plugin to change the response of all sites responseheaders head note