Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

os detection

Status
Not open for further replies.

aliamouse

Programmer
Jul 2, 2003
1
US
I'm looking for some way to detect what os someone is using when they access a website. More specifically, I would like to be able to detect if they are using Windows CE or Palm OS.
 
This may help:
[tt]
<script>
var strNav = navigator.userAgent;
// Check for Windows CE (Pocket PC, Palm-size PC, Handheld PC, Handheld PC Pro)
var isCE = strNav.indexOf(&quot;Windows CE&quot;);
if(isCE > -1) {
//add Windows CE specific code
}
else {
//add code for other platforms
}
// Check for Pocket PC
var isPPC = strNav.indexOf(&quot;240x320&quot;);
if(isPPC > -1) {
// add Pocket PC specific code
}
else {
// add code for other platforms
}
[/tt]
 
You posted to the HTML/CSS forum, but your question probably should have been made to another, perhaps ASP?

This ASP page loops through and displays all the server variables as a HTML web page. The variable &quot;http_user_agent&quot; tells what compatibility the browser has as well as the OS, I think, and a bit more. Try running it on several computers with different operating systems to see exactly how the variable contents change and which part may fit your needs. This may be what you need, but remember that the data you receive from the computer or browser may be limited. The other side is not an open book to you.

Code:
<%@ Language=VBScript %>
<% option explicit %>
<html>
<head><title> My details </head></title>
<body>
<h2>Request ServerVariables List</h2>
<%
Dim V
For Each V in Request.ServerVariables
   response.write &quot;<BR>&quot; & V & &quot;=&quot; & Request.ServerVariables(V)
Next
response.write &quot;--- End of List ---&quot;
%>
</body></html>

Take a look also at this ASP forum thread which may help isolate the data you want or how you can experiment parsing it yourself: thread333-2480
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top