"Smartphone (XHTML)" being served for PC Chrome

drewgg
14 years, 10 months ago
Joomla version: 1.5.20
Mobile Joomla! version: 0.9.7
Chrome version: 5.0.375.127

I've installed Mobile Joomla! on 2 Joomla sites and ran into the same issue. The Chrome brower is loading the XHTML smartphone version instead of the regular site.

It's being triggered in the simple.php plugin lines 60-61.

 
if(preg_match('|'.str_replace(array ('/', '.', '+'), array ('/', '.', '+'), $mime_type).';q=0(.[1-9]+)|i', $_SERVER['HTTP_ACCEPT'], $matches))
$c[$mime_lang] -= (float) $matches[1];
 


The Chrome $_SERVER['HTTP_ACCEPT'] is

application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5

Because the text/html is showing up directly before the ;q=0.9 the it results in the $c array having this state:
 
Array (
[xhtml] => 2
[html] => 1.1
[wml] => 1
[mhtml] => 1
)
 


instead of

 
Array (
[xhtml] => 2
[html] => 2
[wml] => 1
[mhtml] => 1
)
 


Which results in the smartphone version being served.

As a temporary solution I added another conditional statement that looks at the useragent:

 
if(preg_match('|'.str_replace(array ('/', '.', '+'), array ('/', '.', '+'), $mime_type).';q=0(.[1-9]+)|i', $_SERVER['HTTP_ACCEPT'], $matches))
if (stripos($useragent,'chrome')===FALSE)
$c[$mime_lang] -= (float) $matches[1];
 


Have any advice/ideas on this issue?
dryabov
14 years, 10 months ago
What is the UserAgentString of your browser (you can check it at mobilejoomla.com/ua.php)?
Actually, "Mobile - Webbots" plugin should override results of "Mobile - Simple" for most of desktop browsers.
drewgg
14 years, 10 months ago
Your user agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/533.4 (KHTML, like Gecko) Chrome/5.0.375.127 Safari/533.4

Is the useragent on the Chrome browser that loads the mobile version.
drewgg
14 years, 10 months ago
dryabov wrote:
Actually, "Mobile - Webbots" plugin should override results of "Mobile - Simple" for most of desktop browsers.


Would the `order` of the plugins in Joomla effect which plugins override each other? The order the Mobile plugins were installed as is as follows:

"Mobile - Webbots" : -1
"Mobile - Simple" : 0
"Mobile - TeraWURFL" : 0 (this is disabled since we're not running MySQLi)
"Mobile - Always" : 8
"Mobile - Domains" : 9
dryabov
14 years, 10 months ago
The order should be Simple->Webbots->TeraWURFL->Always->Domains.
drewgg
14 years, 10 months ago
Oh good. After correcting that it works correctly for Chrome.

On a related note though. Two of the phones we have on hand are showing the non-mobile site instead of the smartphone. Here are their useragents:

SAMSUNG-SGH-I617/UCHJ1 Mozilla/4.0 (compatible; MSIE 6.0; Windows CE; IEMobile 7.11)

HTC_Touch_Pro2_T7373 Mozilla/4.0 (compatible; MSIE 6.0; Windows CE; IEMobile 8.12; MSIEMobile 6.0)
markflan
14 years, 10 months ago
Hello. I'm having the same issue and I didn't follow what you did to change the order of the plugins. Here is how I have them.

Simple 1
Webbots 2
TeraWURFL 3
Always 4
Domains 5

I am still not getting the default template with Chrome.

I'm sure it must be something simple but I just must be especially dense tongiht!

Any help would be appreciated. Thanks!
dryabov
14 years, 10 months ago
markflan, are all of them published?
miohtama
14 years, 10 months ago
drewgg wrote:
SAMSUNG-SGH-I617/UCHJ1 Mozilla/4.0 (compatible; MSIE 6.0; Windows CE; IEMobile 7.11)

HTC_Touch_Pro2_T7373 Mozilla/4.0 (compatible; MSIE 6.0; Windows CE; IEMobile 8.12; MSIEMobile 6.0)


If you suspect it is user agent problem you can test against TeraWurfl here:

www.tera-wurfl.com/explore/
dryabov
14 years, 10 months ago
miohtama, it's not a problem of TeraWURFL as drewgg doesn't use MySQLi.

drewgg, without database like TeraWURFL it's impossible to determine all of mobile devices correctly. It's better to have full webpages on some mobile devices that mobile webpages on some desktop browsers.
1

By continuing to use this site you consent to the use of cookies on your device as described in our cookie policy unless you have disabled them. This site will not function correctly without cookies.

I accept cookies from this site.