Skip to main content
Topic: use desktop theme for andriod tablet (Read 10391 times) previous topic - next topic

use desktop theme for andriod tablet

using the code PhpBB3 MOD: Replacement mobile browser detection for mobile themes
I'm using question2answer on my site and they have adapted your code to detect if the useragent is mobile - then show the mobile theme.
Code: [Select]
$loweragent=strtolower(@$_SERVER['HTTP_USER_AGENT']);

if (strpos($loweragent, 'ipad')!==false) // consider iPad as desktop
return false;

$mobileheaders=array('HTTP_X_OPERAMINI_PHONE', 'HTTP_X_WAP_PROFILE', 'HTTP_PROFILE');

foreach ($mobileheaders as $header)
if (isset($_SERVER[$header]))
return true;

if (qa_string_matches_one($loweragent, array(
'android', 'phone', 'mobile', 'windows ce', 'palm', ' mobi', 'wireless', 'blackberry', 'opera mini', 'symbian',
'nokia', 'samsung', 'ericsson,', 'vodafone/', 'kindle', 'ipod', 'wap1.', 'wap2.', 'sony', 'sanyo', 'sharp',
'panasonic', 'philips', 'pocketpc', 'avantgo', 'blazer', 'ipaq', 'up.browser', 'up.link', 'mmp', 'smartphone', 'midp'
)))
return true;
The issue I have is that for android tablet I want to show the desktop theme and it is currently showing the mobile theme since the useragent contains the word 'android'.
How do I change the code so for android tablet the desktop theme is used not mobile theme. Is there a way to check the device width in this php code?
Thanks