我试图在firefox扩展中实现xml请求,但没有定义xmlrequest。我可以从内容脚本中打电话,但是我无法从main.js中打出来
我试过Request(options)
var Request = require("sdk/request").Request;
var httpRequest = Request({
url: "https://api.twitter.com/1/statuses/user_timeline.json?screen_name=mozhacks&count=1",
onComplete: function (response) {
var tweet = response.json[0];
}
});它起作用了
但我需要的是我想要发出异步请求
发布于 2014-04-02 21:21:05
你需要把const {Cc, Ci} = require("chrome");融入main.js和
var httprequest=Cc["@mozilla.org/xmlextras/xmlhttprequest;1"].createInstance(Ci.nsIXMLHttpRequest); https://stackoverflow.com/questions/22823236
复制相似问题