Re: Opera 4

by "Peter-Paul Koch" <gassinaumasis(at)hotmail.com>

 Date:  Fri, 30 Jun 2000 11:36:17 GMT
 To:  cupsdell(at)upsdell.com,
hwg-techniques(at)hwg.org
  todo: View Thread, Original
>3.  Opera 4's userAgent string (and related strings) can be selected from a 
>drop-down list, so a user could configure it so that browser-sniffers might 
>detect it as either IE, NN, Mozilla, or Opera, depending on the string 
>selected.  If a site detected it as IE, for example, it might make some 
>assumptions that would cause problems in rendering pages:  e.g., 
>incorrectly assume that a certain DOM or level of JS is supported.

Sorry, but when that happens you have only yourself to blame for coding the 
wrong way.

NEVER do a browser detect when you decide what DOM to use, always do:

if (document.getElementById)
{
NN6, IE5, Opera 4 code
}
else if (document.all)
{
IE4 code
}
else if (document.layers)
{
NN4 code
}

(For more info see once again http://www.xs4all.nl/~ppk/js under DHTML => 
Introduction and DOM)

Opera 4 supports document.getElementById (earlier beta's also supported 
document.all and document.layers, but now they seem to have made the choice 
to go only for the W3C DOM).

ppk
________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com

HWG hwg-techniques mailing list archives, maintained by Webmasters @ IWA