PDA

View Full Version : Expand iframe height according to content?



monaya
09-18-2009, 03:35 PM
Is it possible to have the height of an iframe expand itself according to the content as opposed to specifying width and height absolutely.

I have this now.

<iframe src="<url>" width="945px" height="800px" marginwidth="0" marginheight="0" frameborder="no" scrolling="no" style="border-width:0px; border-color:#333; background:#FFFFFF; border-style:solid;"> </iframe>

ddadmin
09-18-2009, 10:33 PM
In general this is only possible if the page being shown inside the IFRAME is from the same domain as the page displaying the IFRAME. This is due to JavaScript security limitations that prohibit one page from finding out info of another page (ie: height) unless they're on the same domain. With that said, you may want to look at the code of IFRAME SSI script (http://www.dynamicdrive.com/dynamicindex17/iframessi.htm) to get a general understanding of how to go about adjusting the height of the IFRAME based on its contents.