简体   繁体   English

我将如何监控来自站点的所有 http 请求 [Chrome 扩展程序]

[英]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.我目前正在编写一个 chrome 扩展程序,并需要监视并从站点的 http POST请求中获取标头。 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.* .以及一些代码来存储我从details.*获得的变量。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何使用Chrome Extension API获取网页的所有HTTP请求 - How can I get all HTTP requests of a web page by using Chrome Extension API 如何拦截和修改来自Chrome扩展程序的HTTP身份验证请求? - How do I intercept and modify HTTP Auth requests from a Chrome extension? 对于Chrome扩展程序,从https站点调用http站点时出现错误 - For Chrome extension, I get error when calling http site from https site 如何监视扩展/附加请求? - How to monitor extension/addon requests? 我将如何处理? (Chrome扩展程序) - How would I go about this? (Chrome extension) 是否可以使用扩展程序监控 Chrome 中的 HTTP 流量? - Is it possible to monitor HTTP Traffic in Chrome using an extension? 如何从 Chrome 扩展程序发送 HTTP GET 请求? - How do I send an HTTP GET request from a Chrome extension? 如何从Firefox扩展程序发出HTTP请求 - How to make HTTP requests from Firefox extension 使用chrome扩展程序,我将如何阅读页面中的所有HTML并替换特定部分? - Using a chrome extension, how would I read through all the HTML in a page and replace a certain part? 如何编辑这个简单的chrome扩展名,将页面上所有元素的字体颜色更改为红色? - How would I edit this simple chrome extension to change the font color of ALL elements on a page to red?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM