Question

I am developing an addon which will modify all the http request made by firefox. So, I want to listen and modify all the request url made by browser from different sites. How can I get an access to different http request url and modify them. Is there any event which is fired in firefox before requesting any http-request. So, please suggest anyway to access all the request(ajax as well as document.src) made by browser and modify their url. Thanxs!!

Was it helpful?

Solution

You should take a look at tamperdata sources which is a firefox extension to track and modify http & https requests.

OTHER TIPS

You should register for nsIObserver's "http-on-modify-request" event. This will give you every request just before it is issued by the browser.

var {Cc, Ci} = require("chrome");

var httpRequestObserver =
{
  observe: function(subject, topic, data) 
  {
    if (topic == "http-on-modify-request") {
      var httpChannel = subject.QueryInterface(Ci.nsIHttpChannel);
      var requestURI = httpChannel.URI.spec;
      // ... 
    }
  }
};

var observerService = Cc["@mozilla.org/observer-service;1"].getService(Ci.nsIObserverService);
observerService.addObserver(httpRequestObserver, "http-on-modify-request", false);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top