Forum Moderators: open

Message Too Old, No Replies

iframe height in Netscape 6.x

nothing displayed if height=100%

         

aladin

11:05 pm on Jan 30, 2003 (gmt 0)

10+ Year Member



Hi all,

the problem: if the height of the iframe is set to 100% NS 6.x on MAC and WIN shows nothing.

I thought about browser-sniffing to write an absolute height for NS 6.x & relative [100%] for the other browser & NS-Versions.
But how to find out the Gecko-Version with which NS 6.x comes along?
And is it the same Version on MAC and WIN?

I'm not really good in writing Javascript, so maybe somebody can help me.

Thanx in advance for any help.

DrDoc

11:11 pm on Jan 30, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Welcome to Webmaster World!

Why not always give the iframe an absolute height then? ;)

<script type="text/javascript">
winWidth=document.all?document.body.clientWidth:window.innerWidth;
winHeight=document.all?document.body.clientHeight:window.innerHeight;
</script>

aladin

11:25 pm on Jan 30, 2003 (gmt 0)

10+ Year Member



hi drdoc,

thanxs, i tried to put your script inside, but the iframe is embedded in a table...

DrDoc

11:29 pm on Jan 30, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Aah .. and the table height is what?

aladin

11:52 pm on Jan 30, 2003 (gmt 0)

10+ Year Member



the table height is 100% and the iframe in <td height="100%>

i tried the following:
<script type="text/javascript">
var MZ=(document.getElementById?true:false);
var IE=(document.all?true:false);
var winWidth=IE?document.body.clientWidth:window.innerWidth;
var winHeight=IE?document.body.clientHeight:window.innerHeight;
if(winHeight>500){
if(IE){
document.all['main'].style.height="100%";
}
else if(MZ){
document.getElementById('main').style.height="560px";
}
}
</script>

but this treats all ns-versions the same...

DrDoc

5:53 am on Jan 31, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Why do you have the iframe inside a td?
Why not just skip the table?

aladin

4:22 pm on Jan 31, 2003 (gmt 0)

10+ Year Member



cause my menu & the submenu is around the table. i use the iframe instead of a big frameset...

but i got a solution this night/morning :)

shall i post it?

DrDoc

7:23 pm on Jan 31, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Please do!
Taht will help anyone who might run into the same problem in the future ;)

aladin

5:57 pm on Feb 2, 2003 (gmt 0)

10+ Year Member



ok, here is my solution for the problem.

first detect the gecko-version of netscape6 which causes the wrong display:

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

/* 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>

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

hope this will help anyone :)