Re: Browser check code wo'nt work on Mac

by "Cyanide _7" <leo7278(at)hotmail.com>

 Date:  Wed, 17 May 2000 16:01:01 CDT
 To:  j.kampherbeek(at)a1.nl
 Cc:  hwg-languages(at)hwg.org
  todo: View Thread, Original
i have always found it safer to check if the name is IN the appName string, 
not if it IS the appName string. if the browser puts any other info into the 
appName string, your test will fail. also, its always a good idea to have 
the default option covered even if you dont expect it to be followed. there 
are other browsers out there ya know. try this:

Name = navigator.appName;
if(Name.indexOf("Netscape")!=-1)
    {window.location = "kontakt_nav.html";}
else if(Name.indexOf("Microsoft")!=-1)
    {window.location = "kontakt_ie.html";}
else
    {window.location = "kontakt_default.html";}

- Cyanide_7

>
>Hi Jasmeeth,
>
>Jasmeet Singh wrote:
>
> > ...snip.....
> >
> > Name =  navigator.appName;
> > if (Name == "Netscape")
> >    {window.location = "kontakt_nav.html";}
> >
> > if (Name == "Microsoft Internet Explorer")
> >    {window.location = "kontakt_ie.html";}
> > .....snip....
> >
> > Now this code is working fine browsers running on the IBM/PC platform
> > but it hangs on IE4.0 above on iMac (OS 9), could anyone please, let me 
>know
> > how to
> > solve this problem?
>
>Are you sure the Mac returns the right appName for MS IE?
>You could chekc it out by writing appName explicitly.
>
> > thanks,
> > Jasmeet Singh
>
>HTH,  Jan Kampherbeek
>
>=============================================
>Jan Kampherbeek
>j.kampherbeek(at)a1.nl
>Webmaster of SpiderPro,
>the site for professional Internet-developers
>http://www.spiderpro.com
>jan(at)spiderpro.com
>=============================================
>
>

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

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