Tutorial :Sending POST data in XUL?



Question:

I'm trying to send POST data to the current tab, based on this (https://developer.mozilla.org/en/Code_snippets/Post_data_to_window).

But it doesn't seem to be working, nothing happens... I'd be very grateful to whoever shines light on the problem! Thanks in advance! :D

  var dataString = "name1=data1&name2=data2";      var stringStream = Cc["@mozilla.org/io/string-input-stream;1"].    createInstance(Ci.nsIStringInputStream);    if ("data" in stringStream) // Gecko 1.9 or newer    stringStream.data = dataString;    else // 1.8 or older    stringStream.setData(dataString, dataString.length);      var postData = Cc["@mozilla.org/network/mime-input-stream;1"].    createInstance(Ci.nsIMIMEInputStream);    postData.addHeader("Content-Type", "application/x-www-form-urlencoded");    postData.addContentLength = true;    postData.setData(stringStream);      loadURI("http://www.mysite.com/login.php", "http://www.mysite.com/", postData);  


Solution:1

I should probably post that I found the answer. The referer must be null, and if you need to use one, I can dig up the link where it talks about how one is created. Just posting that...


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »