javascript - send a POST request from a firefox extension -


i send post request web server firefox extension.

i have found example send post requests; https://developer.mozilla.org/en/creating_sandboxed_http_connections#http_notifications

but can't work.

i have code this;

    var ioservice = components.classes["@mozilla.org/network/io-service;1"]                               .getservice(components.interfaces.nsiioservice); var uri = ioservice.newuri("http://www.google.com", null, null); gchannel = ioservice.newchannelfromuri(uri);  postdata = "a=1&b=2&c=3";  var inputstream = components.classes["@mozilla.org/io/string-input-stream;1"]     .createinstance(components.interfaces.nsistringinputstream);  inputstream.setdata(postdata, postdata.length);  var uploadchannel = gchannel.queryinterface(components.interfaces.nsiuploadchannel);  uploadchannel.setuploadstream(inputstream, "application/x-www-form-urlencoded", -1); uploadchannel.requestmethod = "post"; uploadchannel.open(); 

but error "cant modify properties of wrappednative"

how using xmlhttprequest object. there no same origin policy in extension development


Comments

Popular posts from this blog

python - Scipy curvefit RuntimeError:Optimal parameters not found: Number of calls to function has reached maxfev = 1000 -

c# - How to add a new treeview at the selected node? -

java - netbeans "Please wait - classpath scanning in progress..." -