Did a bit of digging myself, neither navigator.userAgent nor
navigator.appVersion command would suffice for the CPU part. Hmm, is
javascript simply unable to or I simply don't know better?
As always many thanks.
If VB Script is acceptable then Item 16 on this page will do the trick:
http://www.paulsxp.com/tweaksxp.html. Just remove the persistent
commercials.
Here is a condensed version:
Const HKEY_LOCAL_MACHINE = &H80000002
Set wshShell = WScript.CreateObject("WScript.Shell")
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!" &_
"\\.\root\default:StdRegProv")
sKeyPath = "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"
sValueName = "PROCESSOR_ARCHITECTURE"
oReg.GetStringValue HKEY_LOCAL_MACHINE,sKeyPath,sValueName,sValue
wscript.echo "Processor architecture:", sValue
sKeyPath = "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"
sValueName = "PROCESSOR_IDENTIFIER"
oReg.GetStringValue HKEY_LOCAL_MACHINE,sKeyPath,sValueName,sValue
wscript.echo "Processor identifier:", sValue
For Each pm In GetObject("winmgmts:{impersonationLevel=impersonate}")._
ExecQuery("Select CurrentTimeZone, InstallDate From Win32_OperatingSystem")
With CreateObject("WbemScripting.SWbemDateTime")
.Value = pm.InstallDate
wscript.echo "Installation date:", DateAdd("n", - pm.CurrentTimeZone,
.GetVarDate)
End With
Next
Technically this doesn't fulfill the task, it will only detect Windows
Operating Systems!
I'm guessing that javascript was requested specifically because it is
generally OS independent. For that reason the question should have been
posed in an appropriate group.
That aside, what is the reason for you to detect the OS and or
processor architecture? Which of those particular things is a must have
requirement for you? For example a 32 bit OS or process may be running
on a 64 bit processor. That processor may be IA64 or AMD64 is that
important or not?
Are you looking for Linux Mac etc. or just Windows? If Windows only are
there any specific OS's you aren't interested in 95, NT3.x, 98, NT4,
2000, ME, etc.
Good point on the WHY part and its follow-up questions/comments. Here
I have a web app converted web desktop app ("web desktop app", a term
I coined myself), it supports Windows XP and Vista only and 32bit CPU
only. See, http://www.knowledgenotebook.com/readme.htm. Albeit clear
documentation, some users with 64bit CPU still download and try to
install the app (of course it failed to run). So, the thought is to
detect a user's OS and CPU architecture when he/she visits the page,
if not supported, warn him/her that "the app won't run on the computer
you're using right now" or something like that.
Pegasus, sorry I would have to forgo vb option. Don
>
> Good point on the WHY part and its follow-up questions/comments. Here I
> have a web app converted web desktop app ("web desktop app", a term I
> coined myself), it supports Windows XP and Vista only and 32bit CPU only.
> See, http://www.knowledgenotebook.com/readme.htm. Albeit clear
> documentation, some users with 64bit CPU still download and try to install
> the app (of course it failed to run). So, the thought is to detect a
> user's OS and CPU architecture when he/she visits the page, if not
> supported, warn him/her that "the app won't run on the computer you're
> using right now" or something like that.
If you have CGI rights on the server, you can examine the HTTP_USER_AGENT
server environment variable for clues: the OS version will be there, and
some of the other data my contain versions info that can be traced to
32/64 bit versions. The content of the string is specific to the browser,
but it would be difficult to run an incorrect browser version on a system.
You would need to examine the responses from all the common browsers under
all the acceptable (and some unacceptable) OSs to find out what the
strings mean.
Some of the information is available via Javascript, but the code is
different for different browsers. Search on
javascript "define browser"
to find examples.
The search string
javascript "determine operating system"
also returns some interesting code.
Google is your friend.
--
T.E.D. (tda...@mst.edu)
For HTTP_USER_AGENT
With Firefox 3.5 I get:
Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.1.3) Gecko/
20090824 Firefox/3.5.3 (.NET CLR 3.5.30729)
With IE7 I get:
Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; SLCC1; .NET CLR
2.0.50727; Media Center PC 5.0; .NET CLR 3.5.30729; .NET CLR
3.0.30618)
hmm, I can't seem to see anything that could be translated into cpu
arch. What else could we try?
Thanks.
What do you get from different CPUs? Under Linux I get a note from
Firefox that indicates it's a 64 bit system - maybe something like that
also exists under Windows, or there might be something in the rv or .net
numbers that indicates that. I don't have 64bit Windows available.
--
T.E.D. (tda...@mst.edu)
For 32-bit IE running in Vista/64,
Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; WOW64; Trident/4.0;
SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; InfoPath.2; .NET CLR
3.5.21022; .NET CLR 3.5.30729; .NET CLR 3.0.30729)
And 64-bit IE
Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; Win64; x64;
Trident/4.0; .NET CLR 2.0.50727; SLCC1; Media Center PC 5.0; Tablet PC
2.0; .NET CLR 3.5.21022; .NET CLR 3.5.30729; .NET CLR 3.0.30729)
Neither Firefox or Chrome give any hint it's a 64-bit system.
--
--------- Scott Seligman <scott at <firstname> and michelle dot net> ---------
We must believe in luck. For how else can we explain the success of
those we don't like?
-- Jean Cocteau
> For 32-bit IE running in Vista/64,
> Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; WOW64; Trident/4.0;
> SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; InfoPath.2; .NET CLR
> 3.5.21022; .NET CLR 3.5.30729; .NET CLR 3.0.30729)
>
> And 64-bit IE
> Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; Win64; x64;
> Trident/4.0; .NET CLR 2.0.50727; SLCC1; Media Center PC 5.0; Tablet PC
> 2.0; .NET CLR 3.5.21022; .NET CLR 3.5.30729; .NET CLR 3.0.30729)
>
> Neither Firefox or Chrome give any hint it's a 64-bit system.
IE is clear enough, but what, exactly, do the 32bit and 64 bit FF and
Chrome versions report?
A search on
javascript detect "64 bit" windows
turned up a few suggestions, none of which are reliable.
Maybe you should just ask the user to run some utility that is always
present and indicates the OS and copy/paste the result into a form, or
copy/paste something from a right click menu item somewhere. My
Computer->Properties->General has a lot of non-copyable information -
maybe you could have the user type in the needed info.
--
T.E.D. (tda...@mst.edu)
If your interest includes JavaScript running in Web browsers, you should
ask in news:com.lang.javascript. Be aware that browsers may be
configured, even by default, to lie about the information you want.
If your interest includes JavaScript running in Windows Scripting Host,
you should ask in news:microsoft.public.scripting.wsh.
If your interest includes JavaScript running in an HTA, you should ask
in a news:microsoft.* HTA newsgroup.
If your interest includes JavaScript running in specific non-Windows
operating systems, you should ask in corresponding newsgroups.
A Bing search on detect OS using JavaScript will locate, currently,
1.8E6 Web pages that might help; consider what might be a better search
string.
--
(c) John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v6.05 MIME.
Web <URL:http://www.merlyn.demon.co.uk/> - FAQish topics, acronyms, & links.
Proper <= 4-line sig. separator as above, a line exactly "-- " (SonOfRFC1036)
Do not Mail News to me. Before a reply, quote with ">" or "> " (SonOfRFC1036)