[thelist] iframe as big as necessary?
Kasimir K
evolt at kasimir-k.fi
Tue Mar 30 06:22:40 CST 2004
>> So is there any way I can specify that an iframe should be as big as it
>> needs to be?
> What you have to do is find the document.body.offsetHeight of the page
> in the iframe and set the height of the iframe to this value + a little
> bit more. This works fine.
>
> However, since the page in the iframe comes from another server you
> cannot read out the document.body.offsetHeight (or, in fact, anything
> else).
Yes, but the page in iframe can read its own document.body.offsetHeight,
and call function in parent.
if B's document you then have
parent.set_iframe_size(document.body.offsetHeight);
and in A you have function
function set_iframe_size(iframe_height)
{
iframe_height += 20;
document.getElementById('iframe_id').style.height = iframe_height;
}
I think that should do it.
.kasimir
More information about the thelist
mailing list