3

I have a popup page which has an iframe which in turn loads another page.

I want to resize the iframe height depending on the size of page loaded in it.

MaxRecursion
  • 4,773
  • 12
  • 42
  • 76

1 Answers1

3

one of the easy way is using javascript:

<script language="JavaScript">
  function autoResize(id){
  var newheight;
  var newwidth;

  if(document.getElementById){
    newheight=document.getElementById(id).contentWindow.document .body.scrollHeight;
    newwidth=document.getElementById(id).contentWindow.document .body.scrollWidth;
  }

  document.getElementById(id).height= (newheight) + "px";
  document.getElementById(id).width= (newwidth) + "px";
}
</script>

<IFRAME SRC="Iframef/iframep.aspx" width="100%" height="200px" id="iframe1" marginheight="0" frameborder="0" onLoad="autoResize('iframe1');"></iframe>
Ashwini Verma
  • 7,477
  • 6
  • 36
  • 56