Complete list of Mobile User Agents for c5touch

Permalink 1 user found helpful
I have compiled a list of mobile browser user agents for andrews tutorial. It is more complete, so will increase the amount of visitors that get correctly redirected. if you have any trouble pm me. you can put this in theme switcher.php in the /libraries section you could also just edit the code
<?
class ThemeSwitcher {
   public function checkForIphone($view) {
      if (strstr($_SERVER['HTTP_USER_AGENT'], 'iPhone') ||
         strstr($_SERVER['HTTP_USER_AGENT'], 'Android') ||
         strstr($_SERVER['HTTP_USER_AGENT'], 'Blackberry') ||
         strstr($_SERVER['HTTP_USER_AGENT'], 'BlackBerry') || 
         strstr($_SERVER['HTTP_USER_AGENT'], 'OperaMobi') ||
         strstr($_SERVER['HTTP_USER_AGENT'], 'Opera Mini') ||
         strstr($_SERVER['HTTP_USER_AGENT'], 'IEMobile') ||
         strstr($_SERVER['HTTP_USER_AGENT'], 'Jasmine') ||
         strstr($_SERVER['HTTP_USER_AGENT'], 'Fennec') ||
         strstr($_SERVER['HTTP_USER_AGENT'], 'Blazer') ||
         strstr($_SERVER['HTTP_USER_AGENT'], 'Minimo') ||
         strstr($_SERVER['HTTP_USER_AGENT'], 'MOT-') ||

1 Attachment

12345j
 
Mnkras replied on at Permalink Reply
Mnkras
very nice, ill add a link :)
ericbuxton replied on at Permalink Reply
When I updated the original list of user-agents, I ran into a PHP error: Cannot Modify header information - headers already sent by (output started at /home/XXXX/XXX/libraries/theme_switcher.php:1)
in
/home/xxxx/xxxx/updates/concrete5.4.1/concrete/libraries/view.php on line 764
12345j replied on at Permalink Reply
12345j
I don't know whats causing that, but that sounds like a database/php error? try a new post for your question in the forums
tbock7117 replied on at Permalink Reply
Did you ever find a solution to this? I'm getting a similar error.
12345j replied on at Permalink Reply
12345j
hi, try replacing the if statement
if (strstr($_SERVER['HTTP_USER_AGENT'], 'iPhone') ||
         strstr($_SERVER['HTTP_USER_AGENT'], 'Android') ||
    strstr($_SERVER['HTTP_USER_AGENT'], 'webOS'))
with
if (strstr($_SERVER['HTTP_USER_AGENT'], 'iPhone') ||
         strstr($_SERVER['HTTP_USER_AGENT'], 'Android') ||
         strstr($_SERVER['HTTP_USER_AGENT'], 'Blackberry') ||
         strstr($_SERVER['HTTP_USER_AGENT'], 'OperaMobi') ||
         strstr($_SERVER['HTTP_USER_AGENT'], 'Opera Mini') ||
         strstr($_SERVER['HTTP_USER_AGENT'], 'IEMobile') ||
         strstr($_SERVER['HTTP_USER_AGENT'], 'Jasmine') ||
         strstr($_SERVER['HTTP_USER_AGENT'], 'Fennec') ||
         strstr($_SERVER['HTTP_USER_AGENT'], 'Blazer') ||
         strstr($_SERVER['HTTP_USER_AGENT'], 'Minimo') ||
         strstr($_SERVER['HTTP_USER_AGENT'], 'MOT-') ||
         strstr($_SERVER['HTTP_USER_AGENT'], 'Nokia') ||
         strstr($_SERVER['HTTP_USER_AGENT'], 'SAMSUNG') ||
         strstr($_SERVER['HTTP_USER_AGENT'], 'Polaris') ||
         strstr($_SERVER['HTTP_USER_AGENT'], 'LG-') ||
pds replied on at Permalink Reply
Thanks for the great list - you have eliminated alot of legwork.

You may want to make an addition - I tested c5Touch with this list on a Blackberry Storm and it wasn't caught.

Adding another line with 'BlackBerry' - second 'B' capitalized - did the trick:

strstr($_SERVER['HTTP_USER_AGENT'], 'BlackBerry') ||
12345j replied on at Permalink Reply
12345j
cool, thanks for letting me know. List is updated now (and should also not cause those errors you guys were getting)