Last active
August 22, 2018 17:08
-
-
Save bitsmanent/7325ca5c075d954dc61406d7e0cdc7aa to your computer and use it in GitHub Desktop.
Track XMLHttpRequest (new)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function trackxhr() { | |
var oxhr = window.XMLHttpRequest.prototype.open; | |
window.XMLHttpRequest.prototype.open = function(method, url, async, usr, pwd) { | |
console.log("XHR OUT", url); | |
this.addEventListener("load", function() { | |
console.log("XHR IN", this.responseText); | |
}); | |
return oxhr.apply(this, arguments); | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment