我正在尝试基于此(https://developer.mozilla.org/en/Code_snippets/Post_data_to_window)将 POST 数据发送到当前选项卡。
但这似乎不起作用,什么也没有发生……我将非常感谢任何能解决问题的人!提前致谢!: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);