Need to be able to display pending and errored ajax requests

Hi there,

I’ve been trying to create a google chrome extension which could show (on page) the number of pending and errored requests made.
I originally was looking into the chrome.devtools.network API however that’s only available within the devtools window itself.
Also was looking at the webRequest API but have been failing to get that working.

I am currently looking into monkeypatching XMLHttpRequest but when I try I just get an ‘Illegal Invocation’ error.
Example of what I’m trying to do below:

var fn = XMLHttpRequest.prototype.open;

XMLHttpRequest.prototype.open = function(a,b,c){
    loggingService.logRequest(a,b,c);
    fn(a,b,c);
}

I also need to be able to deduct from the pending requests counter when they finish but for the moment I’m just trying to initially count pending and errored.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.