Forum Moderators: open
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.
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...
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 :)