Hi,
We are trying to abort http requests, and we are listening to
'http-on-modify-request' observer, but we have been stuck at a strange
problem for several days.
We are using 'subject.cancel(Components.results.NS_BINDING_ABORTED);' to
cancel http request. It works on normal static hyperlinks, like "<a
href='www.google.com'>", however, it is not working on the link of the page
http://www.comp.nus.edu.sg/~xdong/new/test.html, which has an onclick
javascript that changes document.location.
observe: function(subject, topic, data)
{
if (topic == "http-on-modify-request" ) {
var httpChannel =
subject.QueryInterface(Components.interfaces.nsIHttpChannel);
var hostStr = httpChannel.getRequestHeader("Host");
....
....
if((subject instanceof Components.interfaces.nsIRequest)) {
subject.cancel(Components.results.NS_BINDING_ABORTED);
alert(" HTTP Request is cancelled" );
}
}
}
Thanks,
Xinshu
_______________________________________________
dev-tech-network mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-network