Re: Opera Problems - anyone else

by "Andy Innes" <innax(at)icon.co.za>

 Date:  Thu, 28 Mar 2002 15:32:30 +0200
 To:  "Peter-Paul Koch" <gassinaumasis(at)hotmail.com>,
<hwg-techniques(at)mail.hwg.org>
 References:  hotmail
  todo: View Thread, Original
Well, I read through this - and it doesn't really seem like a valid
argument:

"If you want to know whether the browser that views your page supports
certain objects you want to use in your code, you should never EVER use a
browser detect. Sure, you know that this-and-that browser will support your
code while such-and-so browser won't. But how about other browsers, obscure
browsers?

While browser detection works well enough for 90% of your visitors, some
obscure browsers won't be treated correctly and browsers that appear after
you've written the page may not be adequately covered either. The results
would be either a stream of error messages or a script that isn't called
while the browser can easily handle it. In both cases, you're cheating your
end users and coding incorrectly."

Basically - my detect script determines that ANYTHING which is not ie 4 or
later gets redirected to the static page. Unfortunately, Opera 6 is ID'ing
itself as IE 4 or higher by default (on installation).

Here it is:

//<script language="JavaScript">
<!--
function
MM_checkBrowser(NSvers,NSpass,NSnoPass,IEvers,IEpass,IEnoPass,OBpass,URL,alt
URL) { //v3.0
  var newURL='', verStr=navigator.appVersion, app=navigator.appName, version
= parseFloat(verStr);
  if (app.indexOf('Netscape') != -1) {
    if (version >= NSvers) {if (NSpass>0) newURL=(NSpass==1)?URL:altURL;}
    else {if (NSnoPass>0) newURL=(NSnoPass==1)?URL:altURL;}
  } else if (app.indexOf('Microsoft') != -1) {
    if (version >= IEvers || verStr.indexOf(IEvers) != -1)
     {if (IEpass>0) newURL=(IEpass==1)?URL:altURL;}
    else {if (IEnoPass>0) newURL=(IEnoPass==1)?URL:altURL;}
  } else if (OBpass>0) newURL=(OBpass==1)?URL:altURL;
  if (newURL) { window.location=unescape(newURL);
document.MM_returnValue=false; }
}
//-->
</script>
</head>

<body bgcolor="#FFFFFF"
onLoad="MM_checkBrowser(4.0,1,1,4.0,2,1,1,'flat.htm','flashintmsie.htm');ret
urn document.MM_returnValue">

//

Andy
----- Original Message -----
From: "Peter-Paul Koch" <gassinaumasis(at)hotmail.com>
To: <innax(at)icon.co.za>; <hwg-techniques(at)mail.hwg.org>
Sent: Thursday, March 28, 2002 4:07 PM
Subject: Re: Opera Problems - anyone else


>
> >My default page does a browser detect and sends msie 4 or later to the
page
> >with flash and all others to the one without (which displays correctly in
> >NN
> >4.78 and Opera
> >
> >The problem here is that OPERA IDENTIFIES ITSELF AS IE5.0 BY DEFAULT!
> >
> >So - the script runs on Opera - detects ie5.0 - and sends Opera to the
> >wrong
> >page, Opera reads the embed tag and creates a 3-4px gap around the Flash
> >file, thus breaking the table.
> >
> >Can anyone think of a way around this?
>
> Then the script has been written in the wrong way. First of all it is
> possible to detect Opera even when it tries to disguise itself, secondly
> using a browser detect for determining which code branch should run, is a
> bad idea.
>
> Browser detect without problems:
> http://www.xs4all.nl/~ppk/js/index.html?detect.html
> Why not to use it: http://www.xs4all.nl/~ppk/js/index.html?support.html
>
> ppk
>
> _________________________________________________________________
> Chat with friends online, try MSN Messenger: http://messenger.msn.com
>
>

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