Search code examples
firefoxfirefox-addonbrowser-addons

How to detect connections made by the browser from a Firefox add-on?


I'm trying to develop an extension that detects every connection made by the browser to figure out the URLs being accessed. I know that this is possible via writing an HTTP/SOCKS proxy and configuring the browser to flow traffic via that. However, that's kind of overkill for the application that I'm trying to develop and it's best done as a Firefox Add-on if that's possible. Any clues/pointers would be highly appreciated.


Solution

  • Use nsIHttpActivityDistributor and there is many information about the http transaction and socket transport through observeActivity callback.

    Read the official documentation https://developer.mozilla.org/en/Monitoring_HTTP_activity.