Solved

Javascript OS Detection error

Posted on 2004-04-08
3
705 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
[X]
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
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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

In this article, we'll look how to sort an Array in JavaScript, including the more advanced techniques of sorting a collection of records either ascending or descending on two or more fields. Basic Sorting of Arrays First, let's look at the …
I've been trying to accomplish this for a while and it just struck me yesterday how to accomplish this task. I have done searches all over the internet looking for ways to email pages from my applications and finally I have done it!!! Every single s…
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…

707 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