How can I intercept XMLHttpRequests from a Greasemonkey script?
问题 I would like to capture the contents of AJAX requests using Greasemonkey. Does anybody know how to do this? 回答1: The accepted answer is almost correct, but it could use a slight improvement: (function(open) { XMLHttpRequest.prototype.open = function() { this.addEventListener("readystatechange", function() { console.log(this.readyState); }, false); open.apply(this, arguments); }; })(XMLHttpRequest.prototype.open); Prefer using apply + arguments over call because then you don't have to