Forum Moderators: open

Message Too Old, No Replies

Dynamic iFrame Height

Pages not on the host server

         

Poor_Knight

8:54 pm on Oct 15, 2007 (gmt 0)

10+ Year Member



I've found several clues leading me to the conclusion that if the content of an iframe is not on the local host that I cannot dynamically re-size the height of the iframe to match contained the page.

I've only found info. from 1-2 years ago so I was wondering is anything new has cropped up.

Am I out of luck if I have no control over the 3rd party pages being displayed in the iframe?

jimbeetle

9:51 pm on Oct 15, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



This was something I investigated a few years ago and abandoned because I ran into the same problems. Quite a while later I stumbled on what was supposed to be a workaround, but never tried it. It has something to do with first importing the external page into a div, then using js to get the height of the div.

Maybe something along these lines:

<div id="external_page">
<iframe src="external.url" width="400"></iframe>
</div>

Then grab the height of "external_page".

Sounds like it might work, but as I said, it's been a few years.

Poor_Knight

10:57 pm on Oct 15, 2007 (gmt 0)

10+ Year Member



Thanks for the reply. I've read a few things that have alluded to such a solution but I just haven't put it all together yet.

Taking a closer look at what you posted there - how does the height of the div get affected by the iframe? Won't it be set to the static height of the iframe and the iframe content just invoke the scroll bar?

[edited by: Poor_Knight at 10:59 pm (utc) on Oct. 15, 2007]