How detect all iOS devices using Wurfl?

1.5k views Asked by At

We've create a iOS app for our web-site and we want to redirect all iOS visitors to iTunes store. Our web-site use Zend framework with configured and worked wurfl.

Now, we trying redirect via browser name

$bootstrap = $this->getInvokeArg('bootstrap');
$view = $bootstrap->getResource('useragent')->getDevice()->getBrowser();
if($view == 'Chrome') {
    $this->view->mobile = true;
}
3

There are 3 answers

0
Luca P. On BEST ANSWER

CTO @ScientiaMobile and WURFL creator here. I advise you check out http://wurfljs.com/

In a nutshell, if you import a tiny JS file:

<script type='text/javascript' src="http://wurfljs.com/wurfl.js"></script>

you will be left with a JSON object that looks like:

{
 "complete_device_name":"Google Nexus 7",
 "is_mobile":true,
 "form_factor":"Tablet"
}

(that's assuming you are using a Nexus 7, of course) and you will be able to do things like:

if(WURFL.is_mobile){
    //dostuff();
}

As an important aside, we go out of our way to recognize iPhone actual models by exploiting javascript (this allows us to exploit info that is not available through sheer analysis of the HTTP headers)

Please note that I work for the company that offers this free service. Thanks.

0
James Rosewell On

As an alternative answer you might want to consider 51Degrees.mobi. See this blog post for PHP integration, although it will involve running an IIS .NET services alongside.

0
HorusKol On

iOS devices can be identified by checking the device OS capability:

Assuming you've setup a WURFL manager already:

$device = $wurflManager->getDeviceForUserAgent($_SERVER["HTTP_USER_AGENT"]);

if ($device->getCapability("device_os") == "iPhone OS") {
   // device is an iPhone or iPod
}