Skip to content Skip to sidebar Skip to footer

Figuring Out When A Xmlhttprequest Request Was Made Without Callbacks

I'm trying to overload the XMLHttpRequest.* method in JavaScript so a webpage can figure out if an Ajax request took place without using any intrusive callbacks. Now, something lik

Solution 1:

You can keep a reference to the original in some variable before you override the method and then call that variable within the function you overrode:

var temp = XMLHttpRequest.getResponseHeader;
XMLHttpRequest.getResponseHeader = function() { temp.apply(this, arguments); };

That should let you track uses without overriding the functionality provided by the original function.

Solution 2:

XmlHttp is going to be a real problem, its a COM object and doesn't support the sort of prototype manipulation you want to use. Worse yet JQuery avoids XmlHttpRequest in IE even when its available it uses XmlHttp instead.

Post a Comment for "Figuring Out When A Xmlhttprequest Request Was Made Without Callbacks"