...

View Full Version : Can't get dynamic iFrame re-size to work in Safari. Help!



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

rhinodog8
08-19-2008, 11:05 PM
could we see the code in action please?

Is it Safari 1, 2, or 3? You could try downloading webkit (http://webkit.org) (Safari's beta version and see if it was a glitch and now is fixed…



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum