[英]Get "Remote Address" (IP address) in chrome extension
I am developing a Chrome extension in which I want to get the IP address for each server request that goes from a client in Chrome.我正在开发一个 Chrome 扩展程序,我想在其中获取来自 Chrome 客户端的每个服务器请求的 IP 地址。 For example, see this image:
例如,请参阅此图像:
Is there any Chrome Extension javascript API which I can use which will give me this kind of data?是否有任何我可以使用的 Chrome 扩展 javascript API 会给我这种数据?
I was able to do this using the webReqest API!我能够使用 webReqest API 做到这一点!
manifest.json清单文件
...
"permissions": ["webRequest", "*://*/*"]
...
background.js背景.js
chrome.webRequest.onResponseStarted.addListener(
({ip}) => console.log(`Network request with ${ip}!`),
{urls: ['*://*/*']});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.