0

I am wondering if theres some way to make it so that if there is a bunch of content in an iFrame it will just zoom out on the document essentially so it fits. Making all the content inside the iFrame smaller.

Any ideas how I would do this?

Script:

<script type="text/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:

<iframe id="iframehtml" style="width:100%;height:100%;" onLoad="autoResize('iframe1');"></iframe>

By the way the reason there is no src set for the iFrame is because I have it in JavaScript so when you clicka a button it will edit the html of the iFrame.

user2812028
  • 183
  • 4
  • 16

0 Answers0