Twinster
08-19-2008, 10:04 AM
Hey guys!
Well, I have a dynamic iFrame which changes height every time new content is loaded into it. However, the iFrame re-sizes properly in all browsers when the content is longer then before load.
BUT, here is my problem:
When for example loading something that is shorter then the load before it doesn't down-size in Safari!
In all the other browsers the down-size is working beautifully, but now in Safari.
Please, if someone has a solution for this I would be so great full!
Is there any way to kind of reset the iFrame to height="0" in the beginning of the script or is it just cause Safari doesn't trigger the "onload" function?
The code I am using is:
<script language="JavaScript">
<!--
function autoResize(id){
var newheight;
var newwidth;
if(document.getElementById){
newheight=document.getElementById(id).contentWindow.document .body.scrollHeight;
newwidth=document.getElementById(id).contentWindow.document .body.scrollWidth;
}
document.getElementById(id).height= (newheight) + "px";
document.getElementById(id).width= (newwidth) + "px";
}
//-->
</script>
Best Regards,
Richard
Well, I have a dynamic iFrame which changes height every time new content is loaded into it. However, the iFrame re-sizes properly in all browsers when the content is longer then before load.
BUT, here is my problem:
When for example loading something that is shorter then the load before it doesn't down-size in Safari!
In all the other browsers the down-size is working beautifully, but now in Safari.
Please, if someone has a solution for this I would be so great full!
Is there any way to kind of reset the iFrame to height="0" in the beginning of the script or is it just cause Safari doesn't trigger the "onload" function?
The code I am using is:
<script language="JavaScript">
<!--
function autoResize(id){
var newheight;
var newwidth;
if(document.getElementById){
newheight=document.getElementById(id).contentWindow.document .body.scrollHeight;
newwidth=document.getElementById(id).contentWindow.document .body.scrollWidth;
}
document.getElementById(id).height= (newheight) + "px";
document.getElementById(id).width= (newwidth) + "px";
}
//-->
</script>
Best Regards,
Richard