title: Creating iframe by javascript
body: <p>I have a main page that include a javascript that was creating an iframe dynamically same below:</p>
  
  <pre><code>&lt;script&gt;
     document.domain = "mydomain.com"
  
     var iframe = document.createElement("iframe");
     document.body.appendChild(iframe);
    // creating other element in ifram dynamically 
  &lt;/script&gt;
  </code></pre>
  
  <p>But in IE I kept receiving a security warning because of document.domain = "mydomain.com" (I need document.domain and I can not remove it).</p>
  
  <p>I found a solution for IE8. this is the solution :</p>
  
  <pre><code>var u = 'javascript:(function(){document.open();document.domain="mydomain.com";document.close();})()';
  iframe.src = u;
  </code></pre>
  
  <p>But it does not work on IE6. Is there any solution for my problem?</p>
  
  <p><strong>Note:</strong> I want to create other element in iframe by script and I want to load the content of iframe by src.</p>