Hello,
I am having a problem with a simple script that checks and tells the user
what browser they are using.
First of all, the browser string for Internet Exploxer contains the text
msie and the browser string for a Pocket PC version of internet explorer
contain msie AND ppc
The problem is that when browsing my test page using pocket pc the script
still returns Interent Explorer. My script is below, can anyone tell me
how to make it determine correctly when accessing via pocket pc? IT works
ok usign using all the other browsers.
Thanks,
td.
http://www.pocketpcheaven.blogspot.com/
<?
$agent = getenv("HTTP_USER_AGENT");
// check to see if running ie
if (preg_match("/MSIE/i", "$agent")) {
$result = "You are using Microsoft Internet Explorer.";
}
//check to see if running Firefox
else if (preg_match("/Firefox/i", "$agent")) {
$result = "You are using Mozilla Firefox.";
}
// check to see if running opera
else if (preg_match("/Opera/i", "$agent")) {
$result = "You are using Opera.";
}
// check to see if running pocket pc browser
else if ((preg_match("/PPC/i", "$agent")) && (preg_match("/MSIE/i",
"$agent"))) {
$result = "You are using Pocket PC Internet Explorer.";
}
// if anything else just display the browser string
else {
$result = "You are using $agent";
}
?>
<HTML>
<HEAD>
<TITLE>Browser Match Results</TITLE>
</HEAD>
<BODY>
<? echo "<P>$result</P>"; ?>
</BODY>
</HTML>