Indiigo007
Junior Member
- Nov 11, 2009
- 189
- 191
Hi, I have the following code to detect user agent:
However, it thinks Chrome is "Safari." How do I modify this (or add to this) so it distinguishes Chrome from Safari?
Any help would be much appreciated.
Code:
<?php
function agent($browser) {
$useragent = $_SERVER['HTTP_USER_AGENT'];
return strstr($useragent,$browser);
}
if(agent("Firefox") != FALSE) {
header('Location:http://location1.com');
}
else if(agent("Opera") != FALSE) {
header('Location:http://location2.com');
}
else if(agent("Safari") != FALSE) {
header('Location:http://location3.com');
}
else if(agent("MSIE") != FALSE) {
header('Location:http://location4.com');
}
else {
header('Location:http://location5.com');
}
?>
However, it thinks Chrome is "Safari." How do I modify this (or add to this) so it distinguishes Chrome from Safari?
Any help would be much appreciated.