View Full Version : iframes not working in IE

10-03-2005, 07:59 PM

My site has a main page which loads content into and iframe. The iframes all load in fine in Firefox and Netscape but all of a sudden have stopped loading in Internet Explorer. I have tried it on a couple of computers and the results are the same!

It seems really odd for something to work on FF and NS but not on IE - especially as they have been working and suddenly stopped.

Has anyone else ever come across problems like this or have any ideas what to do?

The site and page concerned:




10-03-2005, 11:58 PM
Ok - I messed around with it and the problem is the height tag in the iframe tag.

If I leave it out or set it to a number the page shows fine but if I set it to a % value it disappears!

Any ideas at all????



10-04-2005, 04:27 AM
When you set it to a percentage height, the browser is having trouble determining what height basis to use for the calculation. Neither the containing table cell or table have a height of any kind set. In fact, I could find no containing element with a height set. I'm more surprised that any browser would be able to determine a percentage height under those circumstances, as it would be based upon the height of the page, which is itself influenced by the height of the iframe.

10-04-2005, 10:55 AM
Thanks for that John - I set the containing cell size and then used a % and it worked fine. Thats said, I tried to use a % for both the iframe and the containing cell heights so that the page would expand/contract if toolbars etc appear but this again did not work.

I have used %s for the width values so is there any way to do this for height as well?

10-04-2005, 03:20 PM
Well, once again, if percent is all the browser has to go on for height, you are back to the same situation I described before. Height and width are each treated a little differently in the browser. 100% of the width of a page is either what its width is set at or adds up to (if there are several elements on the page, side by side, with set widths) or the width of the window (viewport). With no set height it is a different story as, vertical scrolling is always implied unless a specific height is set for the body element.

Javascript may be used to get an element(s) to adjust their height after the page is loaded - based either upon the height of their contents or the height of the page. Neither of these figures can be known until after the page is loaded though. Since you are using an iframe, there is a script here on DD that will resize it depending upon how high its content is but, it will only work with iframes displaying pages from the same domain as the top level page containing the iframe: