如何用greasemonkey拦截xhr [英] how intercept xhr with greasemonkey
本文介绍了如何用greasemonkey拦截xhr的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我尝试了以下代码:
(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);
但是,在firefox 3.07上,GM无法使用。
But it doesn't work with GM on firefox 3.07.
在JS控制台中,我可以读取错误: XMLHttpRequest.prototype未定义
In JS console i can read the error : XMLHttpRequest.prototype is undefined
有什么问题?
推荐答案
Greasmonkey和Firefox 3.x目前不支持原型 - 属性。请参阅以下机票了解更多信息:
Greasmonkey and Firefox 3.x doesn't currently support the "prototype"-property. Please see the following ticket for more information:
http://greasemonkey.devjavu.com/ticket/164
这篇关于如何用greasemonkey拦截xhr的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文