0

I'm trying to capture all of the incoming responses by patching XMLHttpRequest.prototype.send. Pasting the following code in console works, but when I put it in my extension's content scripts it does nothing.

const send = XMLHttpRequest.prototype.send;
window.XMLHttpRequest.prototype.send = function () {
  this.onreadystatechange = function () {
    if (!this.readyState == this.DONE) return;
    console.log(this.response);
  };
  send.apply(this, arguments);
};```

0 Answers0