473,407 Members | 2,312 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 software developers and data experts.

Detect and Display Windows Version

Please help. Looking for a script to detect and display what version of
Windows a user is running.

Thanks in advance.
Rich
Nov 28 '05 #1
9 11570
Ri**@nospam.com said the following on 11/28/2005 1:23 PM:
Please help. Looking for a script to detect and display what version of
Windows a user is running.


When you find it, can you post back the results it gives when executed
on a MAC or a Linux based system?

But, stop looking as trying to figure out what you are trying to figure
out goes outside the security boundaries of the browser.

But, if your users need you to tell them the OS, they don't need a
computer.....

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Nov 28 '05 #2
The scipt is for an intranet site. We only have Win OS machines so MAC and
Linux is not an issue. What I am trying to do is show the user their OS,
version of Media Player and Browser version. I am able to do the last 2 but
can't figure out how to show the OS.
Nov 28 '05 #3
VK

Ri**@nospam.com wrote:
The scipt is for an intranet site. We only have Win OS machines so MAC and
Linux is not an issue. What I am trying to do is show the user their OS,
version of Media Player and Browser version. I am able to do the last 2 but
can't figure out how to show the OS.


You cannot do it directly from the available browser info, because in
userAgent string (and other places) Microsoft uses version codes (5.0,
5.1 etc) and not the market names like Windows ME, Windows XP etc.

So you have to make (or find) a match table {version code : marken
name}, study navigator.userAgent for code and display the match from
that table.

This is the only way I can think of.

Nov 28 '05 #4
Ri**@nospam.com wrote:
Please help. Looking for a script to detect and display what version of
Windows a user is running.

Thanks in advance.
Rich
There's a place called the Microsoft Developer Network (MSDN) that you
can search for such things.

You can look at the platform property of the navigator object, or you
can try the clientInformation object (they seem identical for all
practical purposes). All you will get for the platform is 'Win32' which
is probably anything from Windows 95 onward (or maybe even Windows 3.1
with the 32-bit stuff added, I dunno) and note that users can likely
spoof that if they want.

The properties of both objects are shown in IE by the following ( -
Mozilla/Gecko does not support the clientInformation object):

<script type="text/javascript">

var HTMLstring = '';
if ('object' == typeof navigator){
HTMLstring += '<h1>Navigator properties</h1>';
for (var prop in navigator){
HTMLstring += '<b>' + prop + '</b>: ' + navigator[prop] + '<br>';
}
}
if ('object' == typeof clientInformation){
HTMLstring += '<h1>clientInformation properties</h1>';
for (prop in clientInformation){
HTMLstring += '<b>' + prop + '</b>: ' + clientInformation[prop] +
'<br>';
}
}
document.write(HTMLstring);

</script>


Navigator object:
<URL:
http://msdn.microsoft.com/workshop/a..._navigator.asp
clientInformation object:
<URL:
http://msdn.microsoft.com/workshop/a...nformation.asp

--
Rob
Nov 28 '05 #5
A while ago I found a script that was able to redirect a user based on the
version OS. At the time I only needed to detect NT4 vs Win2k/XP. Here is
the script:

<script>
var n = navigator;
var ua = ' ' + n.userAgent.toLowerCase();

// find windows platform

var is_win = ua.indexOf('win') > 0;
var is_winnt4 = (ua.indexOf('nt 4.0') > 0 && ua.indexOf('win') > 0);

if(is_winnt4){document.location = "wm_player_framesetnt.html"}
else {document.location = "wm_player_framesetxp.html"}
</script>

This is why I thought it was possible to also detect Win2k vs XP.
Nov 29 '05 #6
Ri**@nospam.com wrote:
A while ago I found a script that was able to redirect a user based on the
version OS. At the time I only needed to detect NT4 vs Win2k/XP. Here is
the script:

<script>
var n = navigator;
var ua = ' ' + n.userAgent.toLowerCase();

// find windows platform

var is_win = ua.indexOf('win') > 0;
var is_winnt4 = (ua.indexOf('nt 4.0') > 0 && ua.indexOf('win') > 0);

if(is_winnt4){document.location = "wm_player_framesetnt.html"}
else {document.location = "wm_player_framesetxp.html"}
</script>

This is why I thought it was possible to also detect Win2k vs XP.


The user agent string for IE on the machine that I'm using at the moment
comes up as:

Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.1.4322)

You work it out[1]. :-)

I think as VK says, you need to reverse engineer it. Every time you get
a user agent string you can't decipher or haven't come across before,
visit the machine, find out what it's running and add it to your
user-agent-deciphering routine.

But it will only work if you can control what the UA string is (the sys
admins at some places I work do, but not all). How do you know someone
isn't running some other browser/UA and putting whatever in the UA string?
1. XP Pro SP 1
--
Rob
Nov 29 '05 #7
RobG said the following on 11/28/2005 10:08 PM:
Ri**@nospam.com wrote:
A while ago I found a script that was able to redirect a user based on
the
version OS. At the time I only needed to detect NT4 vs Win2k/XP.
Here is
the script:

<script>
var n = navigator;
var ua = ' ' + n.userAgent.toLowerCase();

// find windows platform

var is_win = ua.indexOf('win') > 0;
var is_winnt4 = (ua.indexOf('nt 4.0') > 0 && ua.indexOf('win') > 0);

if(is_winnt4){document.location = "wm_player_framesetnt.html"}
else {document.location = "wm_player_framesetxp.html"}
</script>

This is why I thought it was possible to also detect Win2k vs XP.

The user agent string for IE on the machine that I'm using at the moment
comes up as:

Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.1.4322)

You work it out[1]. :-)

I think as VK says, you need to reverse engineer it. Every time you get
a user agent string you can't decipher or haven't come across before,
visit the machine, find out what it's running and add it to your
user-agent-deciphering routine.

But it will only work if you can control what the UA string is (the sys
admins at some places I work do, but not all). How do you know someone
isn't running some other browser/UA and putting whatever in the UA string?
1. XP Pro SP 1


Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR
1.1.4322; .NET CLR 2.0.50727)

Windows XP Home SP2

It will be interesting to see how people differentiate XP Pro from XP
Home from the UA string :)

I still say you can't reliably get the OS from the browser. Keyword
being reliably.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Nov 29 '05 #8
Randy Webb wrote:
RobG said the following on 11/28/2005 10:08 PM: [...]
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR
1.1.4322; .NET CLR 2.0.50727)

Windows XP Home SP2
How about:

Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)

Windows 2000 Pro SP 4 (no .NET framework - I have no use for it - hence
on CLR stuff I guess).

It will be interesting to see how people differentiate XP Pro from XP
Home from the UA string :)

I still say you can't reliably get the OS from the browser. Keyword
being reliably.


No argument with that.
--
Rob
Nov 29 '05 #9
VK

VK wrote:
You cannot do it directly from the available browser info, because in
userAgent string (and other places) Microsoft uses version codes (5.0,
5.1 etc) and not the market names like Windows ME, Windows XP etc.

So you have to make (or find) a match table {version code : marken
name}, study navigator.userAgent for code and display the match from
that table.


And these Microsoft tables will help you:
<http://msdn.microsoft.com/workshop/author/dhtml/overview/aboutuseragent.asp#UARegistry>

Nov 30 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Etienne Charland | last post by:
Hi, I am trying to determine if the current OS supports alpha channel, to know which version of the icons to load. I have written code that detects Windows XP or later, and it works really well....
23
by: David McCulloch | last post by:
QUESTION-1: How can I detect if Norton Internet Security is blocking pop-ups? QUESTION-2a: How could I know if a particular JavaScript function has been declared? QUESTION-2b: How could I...
3
by: Raj | last post by:
Hi All, Is it possible to detect if a client software is installed on a machine using browser javascript. we are building a web/windows software and when the user logs into the web application,...
2
by: Yurij Nykon | last post by:
Hi all. How can I detect the version of Flash-Plugin installed in Internet Explorer? In Netscape i can do this with following java script navigator.plugins.description But it doesn't works...
1
by: oreng | last post by:
Hey all, I have some problems detecting whether the client's browser javascript is enabled at the server side. While Request.Browser.JavaScript only check if the browser enable java script (and...
3
by: zZ | last post by:
Hi All, I need to detect the framework installed from both VB.Net and VB6. Can someone give me an hint? Thanks for any tip. Kind regards, Zen
2
by: dever | last post by:
I checked my color printers's Printersettings.SupportsColor, which all showed false. What is wrong that I could not use this property. Also, what other way to detect if a printer is color...
1
by: Kevin | last post by:
Hi! There is a way to detect which office version have a Windows? Thanks
6
by: Fred Hedges | last post by:
Using .NET 1.1, I need to be able to detect if Themes are enabled or disabled, not for a specific application, but for the system as a whole (ie. the current user). The reason I need to be able to...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.