i am a relative newbie and am trying out some basic scripts and was wondering what the general consensus is when trying to detect the browser type.
I have been trying to use the if (document.all){do this} else if (document.layers){do that} method and after puzzling for a while i found my netscape 7 will not take this method, if i remove the if(document.layers) leaving the else {do that} it works fine, but is this a good idea??
Anyways, is this method an outdated method as I learnt it from quite an old tutorial??
What is the predominant method for browser detection??
ps-heres my script that won’t work in case there is a prob
<HTML>
<HEAD>
<script language=”javascript”>
function doit() {
if (document.layers){
alert(“netscape”);}
else if (document.all){
alert(“IE”);}
}
</script>
</HEAD>
<BODY>
<body onload=doit();>
</body>
</HTML>