title: Auto resize iframe height when the height of the iframe contents change (same domain)
body: <p>I am loading an iframe inside a page, which the length of the content of the iframe will be changed from time to time. I have implemented the following solution. However the height is fixed as the dyniframesize only get call when iframe.onload.</p>
  
  <p>It is possible to have the iframe to be resized accordingly from time to time the height of the iframe changed?  </p>
  
  <pre><code>&lt;iframe src ="popup.html" frameborder="0" marginheight="0" marginwidth="0" frameborder="0" scrolling="auto" id="ifm" name="ifm" onload="javascript:dyniframesize('ifm');" width="100%"&gt;&lt;/iframe&gt; 
  
  function dyniframesize(down) { 
  var pTar = null; 
  if (document.getElementById){ 
  pTar = document.getElementById(down); 
  } 
  else{ 
  eval('pTar = ' + down + ';'); 
  } 
  if (pTar &amp;&amp; !window.opera){ 
  //begin resizing iframe 
  pTar.style.display="block" 
  if (pTar.contentDocument &amp;&amp; pTar.contentDocument.body.offsetHeight){ 
  //ns6 syntax 
  pTar.height = pTar.contentDocument.body.offsetHeight +20; 
  pTar.width = pTar.contentDocument.body.scrollWidth+20; 
  } 
  else if (pTar.Document &amp;&amp; pTar.Document.body.scrollHeight){ 
  //ie5+ syntax 
  pTar.height = pTar.Document.body.scrollHeight; 
  pTar.width = pTar.Document.body.scrollWidth; 
  } 
  } 
  } 
  &lt;/script&gt; 
  </code></pre>