I used the following block of code to redirect site to a page when it is been accessed via mobile phone browser and to another page when it is accessed via desktop browsers. This is tested in ie, firefox, netscape, opera, chrome and some mobile phone browser simulator. This works well for me.
$BrowserSplit = explode("/",$HTTP_SERVER_VARS["HTTP_USER_AGENT"]);
$Machine = $BrowserSplit[0];
if($Machine == "Opera" || $Machine == "Mozilla") {
header("location: $site1");
}
else {
header("location: $site2");
}
?>
No comments:
Post a Comment