[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 933
  • Last Modified:

Detecting Windows XP 64-bit

Hi,

If possible, I would like to be able to use JavaScript to detect if the user is accessing the web page with specifically the 64-bit version of Windows XP, and display a message if this is the case (to display text that is specific to Windows XP 64-bit users only).

Could you please post some sample code to do this?  Perhaps it is possible to use an if statement to check the user agent for Windows XP 64-bit and render the text if found?

Thanks in Advance,

Richard
0
Richard2000
Asked:
Richard2000
  • 4
  • 3
1 Solution
 
Richard QuadlingSenior Software DeverloperCommented:
Hi Richard2000,


The js object is called navigator. It contains many properties. I think the platform property is the best guess, but I don't know if windows xp 64 has anything different to windows xp normal.

Regards,

Richard Quadling.
0
 
Richard2000Author Commented:
Thanks for your reply.

Is there sufficient information in navigator (or anything else) to specificially detect the 64-bit version of Windows XP, with JavaScript?
0
 
Richard QuadlingSenior Software DeverloperCommented:
I don't have a 64 bit version to test anything against.

If you do, try this as a HTML file ...

<html>
<head>
<title>Dump Navigator</title>
<script type="text/javascript">
function DumpNavigator()
 {
 s_navigator = '';
 for(var i_index in navigator)
  {
  s_navigator = s_navigator + "'" + i_index + "' = '" + navigator[i_index] + "'<br />";
  }
 document.getElementById('navigator').innerHTML = s_navigator;
 }
</script>
<head>
<body onLoad="DumpNavigator();">
<div id="navigator"></div>
</body>
</html>

On my machine for FireFox 1.5.0.4 I get ...

'platform' = 'Win32'
'appCodeName' = 'Mozilla'
'appName' = 'Netscape'
'appVersion' = '5.0 (Windows; en-US)'
'language' = 'en-US'
'mimeTypes' = '[object MimeTypeArray]'
'oscpu' = 'Windows NT 5.1'
'vendor' = ''
'vendorSub' = ''
'product' = 'Gecko'
'productSub' = '20060508'
'plugins' = '[object PluginArray]'
'securityPolicy' = ''
'userAgent' = 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.4) Gecko/20060508 Firefox/1.5.0.4'
'cookieEnabled' = 'true'
'onLine' = 'true'
'javaEnabled' = 'function javaEnabled() { [native code] }'
'taintEnabled' = 'function taintEnabled() { [native code] }'
'preference' = 'function preference() { [native code] }'


Same machine for IE6 I get ...

'appCodeName' = 'Mozilla'
'appName' = 'Microsoft Internet Explorer'
'appMinorVersion' = ';SP2;'
'cpuClass' = 'x86'
'platform' = 'Win32'
'plugins' = ''
'opsProfile' = ''
'userProfile' = ''
'systemLanguage' = 'en-gb'
'userLanguage' = 'en-gb'
'appVersion' = '4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; .NET CLR 2.0.50727)'
'userAgent' = 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; .NET CLR 2.0.50727)'
'onLine' = 'true'
'cookieEnabled' = 'true'
'mimeTypes' = ''

The platform seems like. Maybe on Windows XP 64 this will be Win64?
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
Richard2000Author Commented:
Thanks for your code.  Unfortunately, I don't have Windows XP 64-bit to test it on.

I've looked at this page:
http://msdn.microsoft.com/workshop/author/dhtml/overview/aboutuseragent.asp

Not certain if this is relevant to JavaScript or not, but it says on the above page:
Win64 means "System has a 64-bit processor"

This seems to imply that the value platform returns applies to the processor rather than the OS, which may not give the intended result.  For example, a user could have a 64-bit processor, but only be running the regular 32-bit version of Windows XP.

Any ideas?
0
 
Richard QuadlingSenior Software DeverloperCommented:
I think you need to find someone with a winXP64 and get them to run that script and let you know the output.

What you may find is that there is a particular plugin or extension which is only available on xp64. But I don't know anything else.

0
 
Richard QuadlingSenior Software DeverloperCommented:
I think getting this tested on a 64 bit processor is the answer. If you are wanting to write code dependent upon the platform, you HAVE to test it!

I think a combination of cpuClass and platform to get your answer.

I feel enough was given to at least help the acheive the answer.

0
 
Richard2000Author Commented:
I have awarded the points to RQuadling for his help with the question.  Please note that since I don't own or have access to Windows XP 64-bit, I am unable to verify if it would produce the desired results (as discussed in my above comments).
0

Featured Post

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now