F
Frank Rosario
Hello all. My page contains an iFrame. I load content dynamically into
the iframe and resize iFrame to fit all of the content. Here's my
problem. When I first enter a page, I set the iFrame's height via the
iframe.style.height. The first time I visit the page and set the
height, it loads the content and resizes it fine. Change around the
content of the iFrame, still no problem with the resize when I can my
resize code. If I visit a link and then go back to the page; the iFrame
loads with the incorrect height (the content is cut off by a shortened
frame). I know frameResize is being called. It even sets the height
correctly. (Confirmed all this with VS.Net debugger). However, it seems
while the style.height property has changed, the browser doesn't
reflect it. For example, if style.height is set to 100, if read
immediately after both the display.height and the height read 100
(confirmed it in the debugger). However, the browser doesn't reflect
the change and height hasn't changed. Any ideas?
My code:
function frameResize()
{
// this gets the height of the contents of the frame
var frameHeight = document.getElementById('fullPageDiv').offsetHeight;
// gets frame reference from parent
var iFrame;
iFrame = window.parent.document.getElementById('contentIFrame');
//set height of frame
iFrame.style.height = frameHeight;
}
the iframe and resize iFrame to fit all of the content. Here's my
problem. When I first enter a page, I set the iFrame's height via the
iframe.style.height. The first time I visit the page and set the
height, it loads the content and resizes it fine. Change around the
content of the iFrame, still no problem with the resize when I can my
resize code. If I visit a link and then go back to the page; the iFrame
loads with the incorrect height (the content is cut off by a shortened
frame). I know frameResize is being called. It even sets the height
correctly. (Confirmed all this with VS.Net debugger). However, it seems
while the style.height property has changed, the browser doesn't
reflect it. For example, if style.height is set to 100, if read
immediately after both the display.height and the height read 100
(confirmed it in the debugger). However, the browser doesn't reflect
the change and height hasn't changed. Any ideas?
My code:
function frameResize()
{
// this gets the height of the contents of the frame
var frameHeight = document.getElementById('fullPageDiv').offsetHeight;
// gets frame reference from parent
var iFrame;
iFrame = window.parent.document.getElementById('contentIFrame');
//set height of frame
iFrame.style.height = frameHeight;
}