Get "Remote Address" (IP address) in chrome extension

Viewed 3619

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. For example, see this image:

developer tools screenshot

Is there any Chrome Extension javascript API which I can use which will give me this kind of data?

1 Answers

I was able to do this using the webReqest API!

manifest.json

...
"permissions": ["webRequest", "*://*/*"]
...

background.js

chrome.webRequest.onResponseStarted.addListener(
    ({ip}) => console.log(`Network request with ${ip}!`),
    {urls: ['*://*/*']});
Related