title: auto resize iframe with chrome
body: <p>I was asked to resize iframes according to it's content. After long hours of searching, I've finally got it to work as needed but it only works on firefox. I need it to work at least on chrome, ff and ie. Here is the script</p>
  
  <pre><code>&lt;script language="JavaScript"&gt;
  &lt;!--
  function autoResize(id){
      var newheight;
  
      if(document.getElementById){
          newheight=document.getElementById(id).contentWindow.document.body.scrollHeight; //ff
          newheight=document.getElementById(id).contentDocument.body.offsetHeight; //chrome
          newheight=document.getElementById(id).contentDocument.documentElement.scrollHeight;
  
          }
  
      document.getElementById(id).height= (newheight) + "px";
  }
  //--&gt;
  &lt;/script&gt;
  </code></pre>
  
  <p>and the iframe code</p>
  
  <pre><code>&lt;iframe name="result" id="iframe" seamless src="action/search.php" width="100%" onLoad="autoResize('iframe');" marginwidth=0 marginheight=0 frameborder=0 scrolling="no" style="border:0; overflow:hidden"&gt;
      &lt;/iframe&gt;
  </code></pre>
  
  <p>any suggestion is appreciated.</p>