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-') ||
Viewing 15 lines of 34 lines. View entire code block.
very nice, ill add a link :)
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
in
/home/xxxx/xxxx/updates/concrete5.4.1/concrete/libraries/view.php on line 764
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
Did you ever find a solution to this? I'm getting a similar error.
hi, try replacing the if statement
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-') ||
Viewing 15 lines of 20 lines. View entire code block.
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') ||
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') ||
cool, thanks for letting me know. List is updated now (and should also not cause those errors you guys were getting)