简体   繁体   中英

How would I monitor all http requests coming from a site [Chrome Extension]

I'm currently writing a chrome extension and require to monitor and get a header from a http POST request from a site. How would I wait for a request from the site and then save the specified header's argument to a variable for future use?

I ended up using:

chrome.webRequest.onSendHeaders.addListener(function (details) {
    //my stuff here
}, {
  urls: ["<all_urls>"],
  types: ["main_frame", "sub_frame", "stylesheet", "script", "image", "object", "xmlhttprequest", "other"]
}, ["requestHeaders"]);

along with some code to store the varible i got from details.* .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM