Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Javascript OS Detection error

Posted on 2004-04-08
3
Medium Priority
?
707 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 1000 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 400 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
A while back, I ran into a situation where I was trying to use the calculated columns feature in SharePoint 2013 to do some simple math using values in two lists. Between certain data types not being accessible, and also with trying to make a one to…
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…

597 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