Jeff Maestas wrote:[color=blue]
> I have to rely on javascript because this html page is being loaded from a
> CD, not a website. I know how to interpret the numbers (5.0, 5.1, etc) to
> find out what the OS is, but when I had "if" statements for each OS version,
> they ALL printed "xxxxxxxx detected", so I guess a series of "if" statements
> will not work. How could I do a switch or case statement to look at
> "navigator.userAgent" output and write the link out for the appropriate MSI?
> Is there some way I can parse only the OS version from the string, so I just
> get the "Windows NT 5.1" or whatever part of the string? In other words,
> everything after the last semicolon (I'll just live with the closing
> bracket).[/color]
"everything after the last semicolon" won't get you what you need. This
is what IE tells me on Windows ME:
appVersion = 4.0
(compatible; MSIE 6.0; Windows 98; Win 9x 4.90; .NET CLR 1.1.4322)
userAgent = Mozilla/4.0
(compatible; MSIE 6.0; Windows 98; Win 9x 4.90; .NET CLR 1.1.4322)
As you can see, everything after the last semicolon is useless for OS
determination.
But if your users can't determine there own OS, how are they going to
manage to make it through an installation process? Not being obtuse, but
knowing the OS is pretty simple. Start>Settings>Control Panel, System
Icon and most Windows will give it to your there in plain text.
But once you figure out the substring parts that you need, look into the
switch/case to do what you are wanting, instead of nested ifs.
--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ -
http://jibbering.com/faq/