Skip to content

Instantly share code, notes, and snippets.

@scodx
Created July 8, 2019 18:27
Show Gist options
  • Save scodx/d82d76f5629d64ad8012afc764fb979f to your computer and use it in GitHub Desktop.
Save scodx/d82d76f5629d64ad8012afc764fb979f to your computer and use it in GitHub Desktop.
intercept ajax request on JS
var oldXHROpen = window.XMLHttpRequest.prototype.open;
window.XMLHttpRequest.prototype.open = function(method, url, async, user, password) {
if (url.indexOf('getVideo') >= 0) {
this.addEventListener('load', function() {
console(this.responseText);
});
return oldXHROpen.apply(this, arguments);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment