I am trying to intercept XHR made from a website to be able to display the data from the response in a more user friendly way.
The ones that are interesting to me are showing up in the network panel using google chrome devtools and I can read the request / response without any issue there.
However, if I try to intercept them with Javascript in the console for instance, I'm intercepting all XHR excepting the ones that are sent to the API containing the useful informations.
From this screenshot, I'm able to display the ones that start by "bz?_" but not the one named "api/".
The request URL for the "api/" one doesn't belong to the same domain.
But if I am able to see them in network panel, shouldn't I also be able to see them in the console?
I have been using this code:
(function() {
var proxied = window.XMLHttpRequest.prototype.open;
window.XMLHttpRequest.prototype.open = function() {
console.log( arguments );
return proxied.apply(this, [].slice.call(arguments));
};
})();
I don't understand why the messages aren't appearing since the open method has been overriden...
I have also tried using the Live HTTP Headers extension Live HTTP Headers extension to peak at the requests and they intercept the same ones excepting the one of interest.
The only way I was able to display some info about the interesting XHR was to manually open the javascript file in Chrome "Sources" panel and insert some "console.log" line where the XHR is created.
In the JS file, it is simply used like a new XHMLHttpRequest and then calling the open method...
// somewhere in the huge JS file
load: function(url) {
this.request = new XMLHttpRequest;
// some other stuff done there
this.request.open(this.parent.method, url, !0);
console.log(this.request);
Thank you in advance!
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…