title: Dynamic iframe not loaded occasionally in Firefox
body: <p>I have some JavaScript code that dynamically injects an iframe in a given HTML page. Unfortunately, in Firefox, and only in Firefox, although the iframe is created from time to time the relevant URL isn't loaded into it. </p>
  
  <p>I know it wasn't loaded because the relevant URL doesn't appear in the Firebug Net tab, and when I inspect the iframe I don't see any expected HTML code in there (when the iframe is on the same domain as the outlying page). I don't see any JavaScript or network errors either.</p>
  
  <p>Here's a code snippet, I've checked all the relevant variables are correct:</p>
  
  <pre><code>    var iframe = document.createElement("iframe");
      iframe.width = options["w"];
      iframe.height = options["h"];
      iframe.scrolling = "no";
      iframe.marginWidth = 0;
      iframe.marginHeight = 0;
      iframe.frameBorder = 0;
      iframe.style.borderWidth = 0;
  
      if (node.childNodes.length &gt; 0) 
          node.insertBefore(iframe, node.childNodes[0]);
      else 
          node.appendChild(iframe);
  
      iframe.contentWindow.location = iframeSrc + "?" + querystring;
  </code></pre>
  
  <p>Here's an example URL that is set for the iframe (the issue also recreates when the URL points to an external server, had to omit the 'http://' at the beginning otherwise I couldn't post the question):</p>
  
  <pre><code>127.0.0.1:8000/widget/iframe/index.html?style=slide-top-to-bottom&amp;culture_code=en_us&amp;c=26&amp;sc=1324&amp;title=Top%20News&amp;caption=Top%20Stories&amp;order=relevance&amp;count=20&amp;w=250&amp;h=300&amp;timestamp=true&amp;scrollbar=false&amp;theme=ui-lightness&amp;className=8815455464592103&amp;referrer=http%3A%2F%2F127.0.0.1%3A8000%2Fwidget%2Fbuilder%2Findex.html
  </code></pre>
  
  <p>Doing some research on the web, I found this unfixed Firefox bug which seems related to this issue:
  <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=279048" rel="nofollow">https://bugzilla.mozilla.org/show_bug.cgi?id=279048</a></p>
  
  <p>After reading the bug, I tried several solutions none of which solved the issue:</p>
  
  <ul>
  <li>Setting iframe.src instead of iframe.contentWindow.location</li>
  <li>Adding a random parameter to the querystring</li>
  <li>Adding the '#' symbol with a random number at the end of the URL</li>
  <li>Giving the iframe a random name</li>
  </ul>
  
  <p>Does anyone have a workaround for this annoying Firefox bug? Or is the issue I'm describing unrelated to the bug and has a different solution?</p>