about using the chrome plugin to modify the response of all websites Responseheaders header note

Source: Internet
Author: User

1 At present, 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-down to view the element, in order to display its debug panel. One click and it's gone;

2 Modify the value of the response header, in the Web page debugging tool on the network panel will not change, that is, can not feedback out, but found in the actual use, has changed, in the popup plugin debug panel output values can also be seen to be changed, this is very depressed;

3 For example, the Onheadersreceived event, which defaults to the details parameter is not included in the Responseheaders property, if necessary to the third parameter of the AddListener added, and this parameter is not indiscriminate, if added, It will output the JS error prompt on the popup debug panel, saying that this parameter is for this on event, only what parameters are allowed. As I randomly add a ["RESPONSEHEADERSD", "blocking"], it prompts as follows: Uncaught Error: Invalid value for argument 2. Property '. 0 ': Value must is one of: [Blocking, Responseheaders]. Because I wrote a D, so, if you do not understand what parameters can be accepted here, you can deliberately write the wrong, let you know what it can use,


, you can see that it can open two debug panels, one is the popup, the other is the current page, if you modify the code, directly F5 the popup debugger will be loaded, do not need to go back to the plug-in management that press Ctrl_+r



4 give all the response URL plus one to allow all domain names cross-domain request head, for example, you want to test some JS function. Use cross-domain requests, but it is not convenient to modify the other side of the data, then you can use this plugin to process. Let the browser take its domain name content as your own, feel free to 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"]);


Below to see the use of this plugin processed Baidu return content, can be used at will, no longer output cross-domain no permissions error



about using the chrome plugin to modify the response of all websites Responseheaders header note

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.