Click to See Complete Forum and Search --> : IFrame scrollbar - IE5.5 IE6 difference


russellr
03-26-2003, 02:56 AM
A tough problem this one...already cost me a whole day.

I have a server-generated page with an iframe (also server-generated). In that iframe is another iframe (also server-generated).

The innermost iframe is "minimized" until the user clicks a "maximize" button.

When the iframe is expanded, it resizes its parent window, which resizes its parent, and so on, up to but excluding the browser window.

The problem is that on IE6, I get unwanted and unnecessary scrollbars around the outer iframe, but on IE5.5 it works perfectly.

For anyone who can help, I've created some test URLs.

If you have IE6, you can see the problem here:
http://www.rootsoftware.com/tests/indexie6.htm

If you have IE5.5, you can see it work perfectly here:
http://www.rootsoftware.com/tests/indexie5.htm

The only difference between the IE5.5 and IE6 code is in the JavaScript function "ResizeWindow".

IE5.5 version has, near the top of ResizeWindow:

i_body_width = document.body.scrollWidth;
i_body_height = document.body.scrollHeight;


IE6 version has, instead:

if (iOrigWidth == 0 && iOrigHeight == 0)
{
iOrigWidth = document.body.offsetWidth;
iOrigHeight = document.body.offsetHeight;
}
i_body_width = iOrigWidth;
i_body_height = document.body.offsetHeight;


This code for IE6 ensures that the window is only resized to the document's width once. Without it, it keeps getting
wider.

I don't expect anyone to figure out how all this code works!

But, if you can view the problem maybe you know the cause or can give me some suggestions.

I can prevent the problem by changing this line (also in ResizeWindow):

document.body.scroll = 'auto';

to

document.body.scroll = 'no';


But that has other ramifications I'm not happy with...

TIA,
Russell Robinson

khalidali63
03-26-2003, 07:31 AM
The reason its happening is that the contents of the inner frames have wider/larger width/length then the external woindow.
You can use a css attribute

overflow:hidden

Lets see if that helps you.

Cheers

Khalid

russellr
03-26-2003, 05:18 PM
Thanks for the suggestion Khalid.

I've put your suggestion in various places and it hasn't made any difference.

I've also put a blue border around the outer iframe, because I'm not convinced that the scroll bars that appear are part of the iframe.

In fact I've said "scroll: no" for that iframe and for the body of the iframe document (frame1ie6-2.htm) and the scrollbars still appear.

I've created www.rootsoftware.com/tests/indexie6-2.htm to show the result.

Interestingly, if you view this with IE5.5, then the browser does obey these style settings!

Perhaps we're looking at a bug in IE6?