I am trying to re-size an iframe based on the actual content of its src so that no scrollbars are necessary. I am decent with client side stuff, but I have not been able to figure this one out... I've tried a hundred combination of things and nothing seems to work. The problem seems to come from the fact that the parent document doesn't know the content of the iframe before it is rendered... I can't figure out how to render it first and then adjust height. Anybody have any idea where I am going wrong?
$(function(){ // this function runs when this document is ready
$("iframe").load(function(){ // this function is supposed to run when the iframe is loaded
var iframe = window.frames[$(this).attr("name")]; // get the iframe in question
var height = iframe.innerHeight;
alert(height); // does nothing
$(this).height(height); // set the iframe height to this height
});
});