I am having trouble getting the CakeRequest::is('mobile') function to
work for iPad and Android devices.  I scoured existing documentation/
groups with no luck.

Basically if is a mobile browser I want to view CSS slightly
differently, only slight changes thats why I did not go to separate
view file.

In AppController beforeFilter I have
                CakeRequest::addDetector('mobile', array('env' => 
'HTTP_USER_AGENT',
'options' => array('iPad')));

I tried several other calls without success:
                CakeRequest::addDetector('ipad', array('env' => 
'HTTP_USER_AGENT',
'options' => array('iPad')));
                CakeRequest::addDetector('ipad_pattern', array('env' =>
'HTTP_USER_AGENT', 'pattern' => '/iPad/i'));
                CakeRequest::addDetector('gecko', array('env' => 
'HTTP_USER_AGENT',
'pattern' => "/Gecko/i"));

This View code:
echo 'Browser: ' . $_SERVER['HTTP_USER_AGENT']
        . ' [mobile:' . CakeRequest::is('mobile') . ']'
        . ' [gecko:' . CakeRequest::is('gecko') . ']'
        . ' [ipad:' . CakeRequest::is('ipad') . ']'
        . ' [ipad pattern:' . CakeRequest::is('ipad_pattern') . ']';

Returns on Firefox, same results for iPad, Android (tho different user
agent stuff):
Browser: Mozilla/5.0 (Windows NT 6.1; rv:8.0) Gecko/20100101 Firefox/
8.0 [mobile:] [gecko:] [ipad:] [ipad pattern:]

Any insights?

Thanks!

GB

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php

Reply via email to