0

I am trying to get an iframe to automatically resize once a user clicks a link inside of the iframe. How can I do this?

Señor Reginold Francis
  • 14,328
  • 15
  • 54
  • 72

1 Answers1

0

You'll need to use some Javascript to do this. If you are interested in making the iframe grow to accommodate the page loaded inside it you can do something like this:

parent.ResizeFrame({documentLoaded}.height());

the {documentLoaded} can be whatever element you want to draw your height from. on the parent page you add the function

function ResizeFrame(height) {
    getElementById("elementid").height(height);
}

a working example with jquery is such:

function ResizeFrame(height) {
    $("#iframeid").height(height);
}

parent.ResizeFrame($("#fileForm").height());
Jeremy B.
  • 9,006
  • 3
  • 42
  • 54