function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
ColinMcGColinMcG 

iFrame resizing within tabs

Hi, I know resizing of iFrames has been tackled before, but the methods don't seem to work when the iFrame is sitting on a VF tab. I am building a multi-tabbed form which will be used to view and input lots of information. For parts of this project, it makes perfect sense to have a second VF page contained within an iFrame, but the problem is that it won't resize properly dynamically. I have this code:

 

function resizeFrame(){
    var newheight=document.getElementById("kpframe").contentWindow.document.body.scrollHeight;
    document.getElementById("kpframe").height=(newheight)+"px";
}

... which I'm calling from the oncomplete event of the tab. This gives me a very small height regardless of the actual height of the iFrame. However, if I call the above script manually after the iFrame is loaded, it shows perfectly.

 

Any ideas about what event I should be tying the above code to so that the size is set correctly when the user chooses the tab it sits on? I think I've tried every combination and I'm getting nowhere. Unfortunately, Premier Support won't help me with this because they say it's a Javascript issue, not a VF one.