本文介绍了检测手机​​与WURFL或mobiledetect.net不工作的Galaxy S3的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经下载WURFL两种API和mobiledetect.net和我的三星Galaxy S3测试它(GT-19300)。

我很惊讶的是,这款智能手机不与没有这些脚本的检测...
一定有什么东西错了...

脚本()返回以下UA银河S3 ...(用户代理:Mozilla的/ 5.0(X11;的Linux x86_64的)为AppleWebKit / 534.24(KHTML,像壁虎)镀铬/ 11.0.696.34的Safari / 534.24),并告知
这是一个桌面Web浏览器。

我的剧本同样的问题()从mobiledetect.net。

  include_once'./inc/wurfl_config_standard.php';$ wurflInfo = $ wurflManager-> getWURFLInfo();$ requestingDevice = $ wurflManager-> getDeviceForUserAgent($ _ GET ['UA']);如果($ requestingDevice-> getCapability('IS_TABLET')=='真'){
   回声平板电脑;
}$ is_wireless =($ requestingDevice-> getCapability('is_wireless_device')=='真');
$ is_smarttv =($ requestingDevice-> getCapability('is_smarttv')=='真');
$ IS_TABLET =($ requestingDevice-> getCapability('IS_TABLET')=='真');
$ is_phone =($ requestingDevice-> getCapability('can_assign_phone_number')=='真');如果(!$ is_wireless){
 如果($ is_smarttv){
  回声这是一个智能电视;
 }其他{
  回声这是一个桌面Web浏览器;
 }
}其他{
 如果($ IS_TABLET){
  回声这是一款平板;
 }否则如果(is_phone $){
  回声这是一个手机;
 }其他{
  回声这是一个移动设备;
 }
}


解决方案

我认为这个问题是你的UA。你用你的手机在桌面模式下的机会?现在它看起来像它本身进行识别桌面,而不是移动,这就解释了为什么没有被检测到。您的用户代理应该看起来更加的线沿线的:

的Mozilla / 5.0(Linux的; U; Android的4.0.4; EN-US; GT-I9300编译/ IMM76K)为AppleWebKit / 534.30(KHTML,例如Gecko)版本/ 4.0移动版Safari / 534.30

如果您检查使用的ScientiaMobile现场WURFL工具( ),它应该拉起来为银河S3。

I have downloaded both wurfl api and mobiledetect.net and testing it with my Samsung Galaxy S3 (GT-19300).

I am very surprised that this smartphone is not detected with none of these script...There must be something wrong...

The script (http://www.gondwanastudio.com/xJava/WURFL/examples/demo/index.php) returns the following UA for the Galaxy S3... (User Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/534.24 (KHTML, like Gecko) Chrome/11.0.696.34 Safari/534.24) and tells that "This is a Desktop Web Browser".

I have the same problem with the script (http://www.gondwanastudio.com/xJava/test.php) from mobiledetect.net.

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";
 }
}
解决方案

I think the issue is with your UA. Are you by chance using your phone in desktop mode? Right now it looks like it is identifying itself as desktop and not as mobile, which explains why it is not being detected. Your user agent should look more along the lines of:

Mozilla/5.0 (Linux; U; Android 4.0.4; en-us; GT-I9300 Build/IMM76K) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30

If you check using the WURFL tool on the ScientiaMobile site (http://tools.scientiamobile.com) , it should pull up as a Galaxy S3.

这篇关于检测手机​​与WURFL或mobiledetect.net不工作的Galaxy S3的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-15 08:34