Dear all,

I amstuck with a trivial problem. I need to intercept XHR calls. There
are a number of code snippets that illustrate how this can be done
with GM. One example is the following:

(function(open) {

    XMLHttpRequest.prototype.open = function(method, url, async, user,
pass) {

        this.addEventListener("readystatechange", function() {
            console.log(this.readyState);
        }, false);

        open.call(this, method, url, async, user, pass);
    };

})(XMLHttpRequest.prototype.open);

Now, the problem is that when I use and execute this snippet, I get an
error: "Error: xmlhttprequest is undefined". I tried window and
unsafeWindow, bu to no avail.

I must be doing something completely wrong or misunderstand a central
concept.

Any ideas?

I am using FF 11 and GM 0.9.18.

Thanks

-- 
You received this message because you are subscribed to the Google Groups 
"greasemonkey-users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/greasemonkey-users?hl=en.

Reply via email to