Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Javascript OS Detection error

Posted on 2004-04-08
3
703 Views
Last Modified: 2012-08-13
I need to re-direct users to different pages depending on what version of windows they are using.  I  have been using the following command to try and see what version is there

<script language="JavaScript">
  var detect = navigator.userAgent.toLowerCase();
  document.write(detect);
</script>

... this returns....

mozilla/4.0 (compatible; msie 6.0; windows nt 5.1; .net clr 1.0.3705)

.. however I am running Windows XP Professional! does anyone know why it would find windows NT 5.1?  is there a different command I should be using?

Obviously I have very little knowledge of Javascript, and any assistance would be helpful.

Thanks,
Paul
0
Comment
Question by:pwill40
3 Comments
 
LVL 17

Accepted Solution

by:
dorward earned 250 total points
ID: 10783219
NT5 is an internal name for XP

(What if the user isn't running Windows at all?)
0
 
LVL 12

Assisted Solution

by:venkateshwarr
venkateshwarr earned 100 total points
ID: 10783286
Hi pwill40,

You are getting the base version of windows.

You can do a comparision something like this
if version > 5.1 => windows xp
if version = 5.0 => windows 2000
if version = 4.0 => windows NT

Here is a complete listing.

http://www.phm.lu/Documentation/Windows/Versions.asp


Cheers!
venkat.
0
 

Author Comment

by:pwill40
ID: 10784950
Thanks for the answers,
that cleared things up,

Cheers,
Paul
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article shows how to create and access 2-dimensional arrays in JavaScript.  It includes a tutorial in case you are just trying to "get your head wrapped around" the concept and we'll also look at some useful tips for more advanced programmers. …
This article discusses the difference between strict equality operator and equality operator in JavaScript. The Need: Because JavaScript performs an implicit type conversion when performing comparisons, we have to take this into account when wri…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

838 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question