English 中文(简体)
Sending POST data in XUL?
原标题:

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);
最佳回答

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...

问题回答

暂无回答




相关问题
CSS working only in Firefox

I am trying to create a search text-field like on the Apple website. The HTML looks like this: <div class="frm-search"> <div> <input class="btn" type="image" src="http://www....

jQuery block moving

I wanna move a div block to the top, so I coded like this: CSS part: .movingPart{ margin-top:80px; } jQuery part: $(document).ready(function() { $( #btn ).click(function() { $( .movingPart )....

Private FireFox plugin

I m looking at getting a FireFox plugin developed - but is it possible to create a plugin that is for private use only, so only those I share it with have it and not open to the masses? Need this for ...

Firefox background image horizontal centering oddity

I am building some basic HTML code for a CMS. One of the page-related options in the CMS is "background image" and "stretch page width / height to background image width / height." so that with large ...

Cross-browser development

I m developing a web application for a new service, starting from Firefox 3.5. The interface design is tableless, only using divs + CSS & performance-blessed practices. Now, while being ...

Cross browser way of setting IFrame to "about:blank"?

Does anybody know a proper, cross-browser way to "empty" an IFrame? Is "about:blank" recognized without error across all browsers? Is it valid to give an IFrame an empty src?

热门标签