Hey I'm trying to figure out how to redirect a URL in FireFox to another URL. At this point I'm just trying to get every page entered in FireFox to redirect to Google, but I can't even get that to work. Once I figure out how to redirect every page to google.com, then I'll add all the conditionals and such to make the plugin useful. Here is the code I have come up with so far.
var httpRequestObserver = {
observe: function(subject, topic, data) {
if (topic == "http-on-modify-request") {
Cu.import("resource://gre/modules/Services.jsm");
httpChannel.redirectTo(Services.io.newURI("http://google.com", null, null));
}
}
get observerService() {
return Cc["@mozilla.org/observer-service;1"].getService(Ci.nsIObserverService);
},
register: function() {
this.observerService.addObserver(this, "http-on-modify-request", false);
},
unregister: function() {
this.observerService.removeObserver(this, "http-on-modify-request");
}
};