Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Urgent - OS detection

Posted on 2004-09-30
7
Medium Priority
?
242 Views
Last Modified: 2010-04-06
Hi experts,

do the asp, php or javascript can detect which OS lang. the user are using ?
ASAP !!!

Thanks for your advice !
0
Comment
Question by:kankan
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
7 Comments
 

Author Comment

by:kankan
ID: 12188324
the script checking MUST compatible with Palm OS!!!!
0
 
LVL 10

Expert Comment

by:rockmansattic
ID: 12188784
0
 

Author Comment

by:kankan
ID: 12191375
ok, let me try for next week ! coz i'm day off on coming weekend!
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 2

Accepted Solution

by:
harveykane earned 750 total points
ID: 12198883
This is a PHP function I have used to detect MAcOS - you should be able to modify it to detect Palm OS.

<?php
//Function
function ismac($useragent) {
//True / False if $useragent is a Mac
  $useragent = strtolower($useragent);
  if (strpos($useragent,"mac") !== false) {
    $mac = true;
  } else if (strpos($useragent,"ppc") !== false) {
    $mac = true;
  } else if (strpos($useragent,"powerpc") !== false) {
    $mac = true;
  } else if (strpos($useragent,"safari") !== false) {
    $mac = true;
  } else {
    $mac = false;
  }
  return $mac;
}


//Function called by....
if (ismac($_SERVER["HTTP_USER_AGENT"] ) === true) {
  echo "Mac Detected";
}
?>

The key here is the variable $HTTP_USER_AGENT variable. This is sent by the browser to your website with every request. Each browser has it's own different $HTTP_USER_AGENT type so I don't know of any way to cover them all without listing each one.

Here are some $HTTP_USER_AGENT types I found for mobile devices. Not a complete list of course, but it should get you started in the right direction. The above function is looking for "mac", "ppc", of "safari" within the $HTTP_USER_AGENT string - substrings only found in Mac Browsers (to my knowledge). You will want to modify these to include your palm browsers rather than Mac browsers.

You will find many more $HTTP_USER_AGENT types by doing a google search. The list is long, major browsers seem to change types every time a new brwowser version is released.

"Windows CE" //Windows CE and Pocket PC
"NetFront" //PalmSource WebBrowser 2.0
"Palm OS" //Eudora Web Browser for Palm
"Blazer" //Handspring Blazer Browser
"Elaine" //RIM Devices
"^WAP.*$" //WAP Browsers
"Plucker" //Plucker Offline download client
"AvantGo" //AvantGo Service


0
 

Author Comment

by:kankan
ID: 12202125
but can detect chinese or english OS ?
0
 
LVL 2

Expert Comment

by:harveykane
ID: 12208202
I'm not sure if browsers in different languages have different user agent strings - I assume they would. I know the above method doesn't seem ideal, having to build every browser into your function, but I dont think there is any other way, short of prompting the visitor to enter their browser / language.
0
 

Author Comment

by:kankan
ID: 12216628
ok thx, i also can do the same way ! thx
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I found this questions asking how to do this in many different forums, so I will describe here how to implement a solution using PHP and AJAX. The logical flow for the problem should be: Write an event handler for the first drop down box to get …
Browsers only know CSS so your awesome SASS code needs to be translated into normal CSS. Here I'll try to explain what you should aim for in order to take full advantage of SASS.
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
The viewer will learn how to count occurrences of each item in an array.

604 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question