Resize iframe

Posted by & filed under Javascript.

In the parent frame:

function doResize(newHeight) {
    document.getElementById('iframe_id').style.height=newHeight+'px';
}

In your iframe:

function alterFrameSize() {
    if (parent.frames.length > 0) {
        parent.doResize(document.body.clientHeight);
    }
}

Call alterFrameSize() using the body onload() method in your iframe.

Leave a Reply

  • (will not be published)

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

Bitnami