title: Resize iframe height according to content height
body: <p>I'm trying to resize an iframe according to height and width of it's content(webpage). I've used a code that I found on stack's other answer. For setup of new width, it seems that works but I can't get that height to work and I don't know why.</p>
  
  <p>You can see and edit my example here: <a href="http://jsfiddle.net/dzorz/pvtr3/" rel="nofollow">http://jsfiddle.net/dzorz/pvtr3/</a></p>
  
  <p>Here is my HTML:</p>
  
  <pre><code>&lt;iframe id="finance-iframe" class="finance-iframe" src="http://wordpress.org" width="100%" height="300px" marginheight="0" frameborder="0" onLoad="autoResize('finance-iframe');"&gt;&lt;/iframe&gt;
  </code></pre>
  
  <p>and javascript:</p>
  
  <pre><code>function autoResize("finance-iframe"){
    var newheight;
    var newwidth;
  
    if(document.getElementById){
      newheight=document.getElementById("finance-iframe").contentWindow.document.body.scrollHeight;
      newwidth=document.getElementById("finance-iframe").contentWindow.document.body.scrollWidth;
    }
  
    document.getElementById("finance-iframe").height= (newheight) + "px";
    document.getElementById("finance-iframe").width= (newwidth) + "px";
  }
  </code></pre>
  
  <p>What am I doing wrong?</p>