I'm trying to intercept all the AJAX request made in plain vanilla JavaScript but what I've found on Stack Overflow doesn't seems to work.
The easiest (and I would say 'functional') code is the following :
(function(open) {
XMLHttpRequest.prototype.open = function() {
alert('Intercept');
open.apply(this, arguments);
};
})(XMLHttpRequest.prototype.open);
I copy/pasted it on my current website that I know makes an AJAX request at some point, did the AJAX request, and no "alert" was displayed.
I'm using Chrome v49.0.2623.87
Is there a new reason that disabled it ?