<p>I'm trying to open a new browser tab with the results of a POST request.  I'm trying to do so using a function containing the following code:</p>

<pre><code>var windowManager = Components.classes["@mozilla.org/appshell/window-mediator;1"]
    .getService(Components.interface
s.nsIWindowMediator);
var browserWindow = windowManager.getMostRecentWindow("navigator:browser");
var browser = browserWindow.getBrowser();
if(browser.mCurrentBrowser.currentURI.spec == "about:blank")
    browserWindow.loadURI(url, null, postData, false);
else
    browser.loadOneTab(url, null, null, postData, false, false);
</code></pre>

<p>I'm using a string as url, and JSON data as postData.  Is there something I'm doing wrong?</p>

<p>What happens, is a new tab is created, the location shows the URL I want to post to, but the document is blank.  The Back, Forward, and Reload buttons are all grayed out on the browser.  It seems like it did everything except executed the POST.  If I leave the postData parameter off, then it properly runs a GET.</p>

<p>Build identifier: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.0.1) Gecko/2008070206 Firefox/3.0.1</p>

[{'answer_id': 36216, 'author': 'Marius', 'author_id': 1585, 'author_profile': 'https://Stackoverflow.com/users/1585', 'pm_score': 0, 'selected': False, 'text': '<p>try with addTab instead of loadOneTab, and remove the last parameter. </p>\n\n<p>Check out <a href="http://developer.mozilla.org/en/Code_snippets/Tabbed_browser" rel="nofollow noreferrer">this page</a> over at the Mozilla Development Center for information on how to open tabs. </p>\n\n<p>You could use this function, for example:</p>\n\n<pre><code>function openAndReuseOneTabPerURL(url) {\n  var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"]\n                     .getService(Components.interfaces.nsIWindowMediator);\n  var browserEnumerator = wm.getEnumerator("navigator:browser");\n\n  // Check each browser instance for our URL\n  var found = false;\n  while (!found &amp;&amp; browserEnumerator.hasMoreElements()) {\n    var browserInstance = browserEnumerator.getNext().getBrowser();\n\n    // Check each tab of this browser instance\n    var numTabs = browserInstance.tabContainer.childNodes.length;\n    for(var index=0; index&lt;numTabs; index++) {\n      var currentBrowser = browserInstance.getBrowserAtIndex(index);\n      if ("about:blank" == currentBrowser.currentURI.spec) {\n\n        // The URL is already opened. Select this tab.\n        browserInstance.selectedTab = browserInstance.tabContainer.childNodes[index];\n\n        // Focus *this* browser\n        browserInstance.focus();\n        found = true;\n        break;\n      }\n    }\n  }\n\n  // Our URL isn\'t open. Open it now.\n  if (!found) {\n    var recentWindow = wm.getMostRecentWindow("navigator:browser");\n    if (recentWindow) {\n      // Use an existing browser window\n      recentWindow.delayedOpenTab(url, null, null, null, null);\n    }\n    else {\n      // No browser windows are open, so open a new one.\n      window.open(url);\n    }\n  }\n}\n</code></pre>\n'}, {'answer_id': 36224, 'author': 'Grey Panther', 'author_id': 1265, 'author_profile': 'https://Stackoverflow.com/users/1265', 'pm_score': 2, 'selected': False, 'text': '<p>Something which is less Mozilla specific and should work reasonably well with most of the browsers:</p>\n\n<ul>\n<li>Create a hidden form with the fields set up the way you need them</li>\n<li>Make sure that the "target" attribute of the form is set to "_BLANK"</li>\n<li>Submit the form programatically</li>\n</ul>\n'}, {'answer_id': 36995, 'author': 'aryeh', 'author_id': 3288, 'author_profile': 'https://Stackoverflow.com/users/3288', 'pm_score': 2, 'selected': False, 'text': '<p>The answer to this was found by <a href="https://stackoverflow.com/questions/36958/stackoverflow-ubiquity-command#36962">shog9</a>.  The postData parameter needs to be a <code>nsIMIMEInputStream</code> object as detailed in <a href="http://developer.mozilla.org/index.php?title=En/Code_snippets/Post_data_to_window" rel="nofollow noreferrer">here</a>.</p>\n'}]
['https://Stackoverflow.com/questions/36144', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/3288/']