Forum Moderators: open

Message Too Old, No Replies

Netscape iframe bug

on 100% height attribute Gecko shows nothing at all

         

xMrMoox

9:13 pm on Jun 9, 2003 (gmt 0)

10+ Year Member



Hi all,

I'm having the same problem a while ago that someone else had where Netscape won't recognize the 100% value for height in an iframe tag - it just shows nothing. This other person posted a solution, I tried it, but it didn't work (basically if it detects netscape, it displays a fixed value, but for other browsers it stays 100%).

Can anyone help me? This was the code that the guy posted (back in Feb)

>>>/* browser detection */
var isNS6 = isNetscape6();

function getGeckoVersion() {
var isGecko = navigator.product == 'Gecko';
return isGecko? parseInt(navigator.productSub) : 0;
}

function isNetscape6() {
var gv = getGeckoVersion();
return gv? gv <= 20020508 : false;
}

function isMozilla_1_1() {
var gv = getGeckoVersion();
return gv? gv >= 20020826 : false;
}

#################################################

then, if it's a netscape6 make the iframe absolute height [don't forget to write the "id" too]:

#################################################

<iframe src="iframe.htm" id="main" name="main" width="620" marginwidth="0" height="100%" marginheight="0" scrolling="auto" frameborder="0"></iframe>
<script language="JavaScript">
if (isNS6) {
document.getElementById('main').style.height = "470px";
}
</script>

>>>

rainborick

2:14 pm on Jun 10, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



You might try executing the JavaScript function for resizing the element with <body onload> so you've given the browser a chance to see the external file that's getting embedded in the <iframe>. I'm also surprised to see you're apparently finding it necessary to special case Netscape vs. Mozilla.

Overall, its my impression that Netscape/Gecko tends to collapse heights whenever the rules allow... and possibly some times when the rules don't strictly allow it, as well. In any case, it certainly has differences with MSIE, so your 100% value is going to get interpreted differently from the start as the browser processes the external source file for the <iframe>.