Opencart 3.0.3.1 + Journal 3.0.46 separate Mobile View and Google Search Console

#21
Code:
RewriteCond %{HTTP_USER_AGENT} "Android|iPhone|iPad" [NC]
is enough for detecting mobile devices.


all smartphones and tablets contains "Android" in UA.
all iPhones conraians "iPhone" in UA.
all iPads conraians "iPad" in UA

UAs above coverage 99% of present mobile devices ;) .

all others strings NOT NEEDED!

Windows Mobile or iPod now not used for Internet surfing.


Hi @AndreyPopov !

I have separate banners, mobile and desktop version.

The only way I managed to make the detection work was using this detection list that I got from the litespeed faq.

RewriteEngine On

RewriteCond% {HTTP_USER_AGENT} "iPhone | iPod | BlackBerry | Palm | Googlebot-Mobile | Mobile | mobile | mobi | Windows Mobile | Safari Mobile | Android | Opera Mini android | avantgo | blackberry | blazer | compal | elaine | fennec | hiptop | iemobile | ip (hone | od) | iris | kindle | lge \ | maemo | midp | mmp | opera \ m (ob | in) i | palm (\ os)? | phone | p (ixi | re) \ / | plucker | pocket | psp | symbian | treo | up \. (navegador | link) | vodafone | wap | windows \ (ce | phone) | xda | xiino "[NC]
RewriteRule. * - [E = Cache-Control : variar = ismobile]

With the list reduced, some Apple devices and my Samsung Galaxy note 8 was not recognized, the desktop banners were visualized on mobile.

After adding this more complete list, mobile banners were recognized on both phones.
 

AndreyPopov

Well-Known Member
#22
once that you can add from your long list - Mobile

all others strings are unnecessary

RewriteCond %{HTTP_USER_AGENT} "Android|iPhone|iPad}Mobile" [NC]
 
Top