Solved

Javascript OS Detection error

Posted on 2004-04-08
3
700 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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

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…
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
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…

705 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now