【发布时间】:2014-01-24 03:52:38
【问题描述】:
我已经下载了 wurfl api 和 mobiledetect.net 并使用我的三星 Galaxy S3 (GT-19300) 对其进行了测试。
我很惊讶在没有这些脚本的情况下没有检测到这款智能手机...... 肯定有什么问题……
脚本 (http://www.gondwanastudio.com/xJava/WURFL/examples/demo/index.php) 为 Galaxy S3 返回以下 UA...(用户代理:Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/534.24 (KHTML, like Gecko) Chrome/11.0.696.34 Safari/ 534.24)并告诉“ 这是一个桌面网络浏览器”。
我对来自 mobiledetect.net 的脚本 (http://www.gondwanastudio.com/xJava/test.php) 有同样的问题。
include_once './inc/wurfl_config_standard.php';
$wurflInfo = $wurflManager->getWURFLInfo();
$requestingDevice = $wurflManager->getDeviceForUserAgent($_GET['ua']);
if ($requestingDevice->getCapability('is_tablet') == 'true') {
echo "Tablet";
}
$is_wireless = ($requestingDevice->getCapability('is_wireless_device') == 'true');
$is_smarttv = ($requestingDevice->getCapability('is_smarttv') == 'true');
$is_tablet = ($requestingDevice->getCapability('is_tablet') == 'true');
$is_phone = ($requestingDevice->getCapability('can_assign_phone_number') == 'true');
if (!$is_wireless) {
if ($is_smarttv) {
echo "This is a Smart TV";
} else {
echo "This is a Desktop Web Browser";
}
} else {
if ($is_tablet) {
echo "This is a Tablet";
} else if ($is_phone) {
echo "This is a Mobile Phone";
} else {
echo "This is a Mobile Device";
}
}
【问题讨论】: