[thelist] Platform Detection and CSS

Erik Mattheis gozz at gozz.com
Mon Jun 24 21:38:01 CDT 2002


To directly answer your question, you'll have better luck detecting
Windows with navigator.appVersion.indexOf("Win") != -1

(watch capitalization)

But the question that comes to mind is: why are you serving different
stylesheets to different browsers/platforms ... I'm not at all saying
that's a bad thing, but if you could explain the trouble you
experience when serving the same stylesheets to different browsers,
someone may be able to suggest a solution that does not require
JavaScript at all, or help you come up with some browser/capability
testing that will best solve your problem.

For instance, your navigator.appName.indexOf("Netscape") will not
differentiate between NN 4.x and NN 6.x, which have entirely
different levels of support for CSS; humongous difference as compared
to the differences between NN 6.x Mac and NN 6.x Win (or 4.x Mac vs
Win for that matter) ... what you need might be better served by

if (document.getElementById)

So "more info" please ...

>I am trying to create a JavaScript that detects the browser and os. I then
>want the JavaScript to write the linked style sheet. It is working on Mac in
>both IE and Netscape but I cannot get it to work on a windows machine. Im
>not much of a JavaScript programmer so any help would be appreciated. The
>script I am using is below.


--

__________________________________________
- Erik Mattheis

(612) 377 2272
http://goZz.com/

Through Mid July
9am - 4pm M-F:
(952) 838 7698

__________________________________________



More information about the thelist mailing list