title: resize iframe internet explorer 9
body: <p>Trying to create a function that re-sizes iframes at <code>window.onload</code>.</p>
  
  <p>The following works with Fire Fox but not IE 9.  After searching I tried a few of the other examples but they mess up the Fire Fox re-size and don't fix the IE 9 re-size.</p>
  
  <p>Any suggestions?</p>
  
  <pre><code>&lt;script type="text/javascript" language="javascript"&gt;
    function sizeFrame() {
      var frames = document.getElementsByTagName('iframe'); 
      for (var i = 0; i &lt; frames.length; i++){ 
        var fID     = frames[i].id; 
        var F       = document.getElementById(fID);
  
        if(F.contentDocument &amp;&amp; F.contentDocument.documentElement.scrollHeight) {
          F.height = F.contentDocument.documentElement.scrollHeight+30; //FF 3.0.11, Opera 9.63, and Chrome
  
        } else if(F.contentDocument &amp;&amp; F.contentDocument.documentElement.offsetHeight) {
          F.height = F.contentDocument.documentElement.offsetHeight+30; //standards compliant syntax – ie8
  
        } else {
          F.height = F.contentWindow.document.body.scrollHeight+30; //IE6, IE7 and Chrome
        }
      }
    }
  
  
    window.onload=sizeFrame; 
  &lt;/script&gt;
  </code></pre>