Refreshing the size of an iFrame

macmastah

Registered
Hi all,

On my website I have an iframe that displays content according to what the visitor clicks on. However, let's say that the user clicks on a page that has lots of text. I've coded the frame so that it automatically adjusts its height to fit the content via a simple javascript. However, the problem is that when he/she clicks on a link that displays a smaller amount of text (in the iframe) after viewing a lot of text, the iframe doesn't update its height. This produces a rather awkward layout, where there is little text, and an unnecessary amount of space below. I noticed that when I refresh the page, the javascript straightens itself out, and the iframe properly adjusts to its content.

How can I fix this?

Thanks
 
This whole layout is awkward. iframes are useful if you have a fixed area that you'd like to use to refresh content, but generally more trouble than they're worth if you're looking for a dynamically-sized area.

It is possible, however; read here for an in-depth discussion.

You should also note that you have some XHTML errors that might cause trouble down the road.
 
Thank you for your help. I was able to fix the problem using the link you provided and another resource. In the future, I think iframes have too many restrictions, and fiddling around with them isn't very useful sometimes. Especially in the layout I had planned.
 
Back
Top