How to communicate with Firefox using C++? -
i on project right simple parental control software, but, want know url requested in firefox take respond based on ... if may because don't know how let software know url requested firefox .. how that? have use c++ in of software.. if there better language task please advice me
in firefox need use xpcom component called nsihttpchannel. script below block abort rqeuests google. channel opened aborted before opening connection server.
var {classes: cc, results: cr, utils: cu} = components; cu.import('resource://gre/modules/services.jsm'); var httprequestobserver = { observe: function(subject, topic, data) { var httpchannel, requesturl; if (topic == 'http-on-modify-request') { httpchannel = subject.queryinterface(ci.nsihttpchannel); requesturl = httpchannel.uri.spec; if (/google\.com/.test(requesturl)) { httpchanel.cancel(cr.ns_binding_aborted); } return; } } }; services.obs.addobserver(httprequestobserver, 'http-on-modify-request', false); //services.obs.removeobserver(httprequestobserver, "http-on-modify-request", false); //run remove observer
Comments
Post a Comment