Skip to content

Instantly share code, notes, and snippets.

Created March 12, 2018 23:23
Show Gist options
  • Select an option

  • Save anonymous/1baccedc914568f85f1af2889dda8055 to your computer and use it in GitHub Desktop.

Select an option

Save anonymous/1baccedc914568f85f1af2889dda8055 to your computer and use it in GitHub Desktop.
var OGSend = XMLHttpRequest.prototype.send;
XMLHttpRequest.prototype.send = function(){
console.log("I AM HOOKED!");
return OGSend.apply(this, arguments);
};
var site = 'https://www.google.com';
// vanilla js
var httpRequest = new XMLHttpRequest();
httpRequest.open('GET', site);
httpRequest.send();
// Works with jquery too
$.ajax(site);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment