473,659 Members | 3,031 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 11587
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.javas cript 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.userA gent 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 clientInformati on 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 clientInformati on 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 clientInformati on){
HTMLstring += '<h1>clientInfo rmation properties</h1>';
for (prop in clientInformati on){
HTMLstring += '<b>' + prop + '</b>: ' + clientInformati on[prop] +
'<br>';
}
}
document.write( HTMLstring);

</script>


Navigator object:
<URL:
http://msdn.microsoft.com/workshop/a..._navigator.asp
clientInformati on 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.toL owerCase();

// 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){d ocument.locatio n = "wm_player_fram esetnt.html"}
else {document.locat ion = "wm_player_fram esetxp.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.toL owerCase();

// 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){d ocument.locatio n = "wm_player_fram esetnt.html"}
else {document.locat ion = "wm_player_fram esetxp.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.toL owerCase();

// 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){d ocument.locatio n = "wm_player_fram esetnt.html"}
else {document.locat ion = "wm_player_fram esetxp.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.javas cript 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.userA gent 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
1240
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. Except a little detail. If the manifest file to load Microsoft.Windows.Common-Controls 6 (and enable XP themes) isn't there on Windows XP, the icons with alpha channel are loaded but don't appear correctly. Would it be possible to detect the version...
23
6505
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 know if Window.Open has been redefined? BACKGROUND:
3
9321
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, we want to detect if our software is installed on the client machine and if so we want to provide more access, or else we want to give the user a limited access to the web site Thanks in Advance
2
10029
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 in IE? Can anyone help me? Thanx in advance,
1
2834
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 so on with Request.Browser.Cookies). I saw some server controls that register a startup script on the page_load and then perform a postback and run the javascript,changing a hidden
3
6299
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
4599
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 printer. TIA
1
2876
by: Kevin | last post by:
Hi! There is a way to detect which office version have a Windows? Thanks
6
1968
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 do this is because of this bug in MFC http://support.microsoft.com/?kbid=319740, which is used to build a component I am in turn making use of. So, I need to detect if Themes are running and if so, see if the correct version of uxtheme.dll is...
0
8337
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8851
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8748
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8531
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8628
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
4175
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4335
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2754
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1739
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.