Re: Opera 4

by Charles A Upsdell <cupsdell(at)upsdell.com>

 Date:  Fri, 30 Jun 2000 11:59:55 -0400
 To:  hwg-techniques(at)hwg.org
 In-Reply-To:  hotmail
  todo: View Thread, Original
At 07:36 AM 06/30/00, you wrote:
>>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
>}

Two points.

First, I made my comment about the user-selectable userAgent strings 
because a lot of sites - over which users have no control - have 
simplistic, faulty browser-detection, and that therefore the users of Opera 
4 will continue to have problems with such sites.

Second, there are valid reasons for doing browser detection unrelated to 
the DOM.  E.g., in some cases it is necessary to use slightly different 
stylesheets for different browsers to avoid critical browser-specific 
differences.  For example, when changing the indentation of bulleted lists, 
different values of the margin and padding properties must be set for 
different browsers:  otherwise, with some browsers, the bullets will 
disappear.


-
Chuck Upsdell
Email:     cupsdell(at)istar.ca or cupsdell(at)torfree.net
Website:   http://home.istar.ca/~cupsdell/

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