I am working on Magento store version 2.1. I'm required to show a different layout and design on the Mobile device, which is different from my default view. For this I added a theme in the root folder of Magento store. I am trying to add this user string -
iPhone|iPod|BlackBerry|Palm|Googlebot-Mobile|Mobile|mobile|mobi|Windows Mobile|Safari Mobile|Android|Opera Mini
I also tried this code -
iPad|iPhone|Android ((?!(2\.|3\.|4\.0)).)
I also added this code in my index.php
-
$mobile_agents = "/(nokia|iphone|android|motorola|^mot\-|softbank|foma|docomo|kddi|up\.browser|up\.link|"
. "htc|dopod|blazer|netfront|helio|hosin|huawei|novarra|CoolPad|webos|techfaith|palmsource|"
. "blackberry|blackberry10|bb10|playbook|alcatel|amoi|ktouch|nexian|samsung|^sam\-|s[cg]h|^lge|ericsson|philips|sagem|wellcom|bunjalloo|maui|"
. "symbian|smartphone|mmp|midp|wap|phone|windows ce|iemobile|^spice|^bird|^zte\-|longcos|pantech|gionee|^sie\-|portalmmm|"
. "jig\s browser|hiptop|^ucweb|^benq|haier|^lct|opera\s*mobi|opera\*mini|320x320|240x320|176x220"
. ")/i";
if (preg_match($mobile_agents, strtolower($_SERVER['HTTP_USER_AGENT']))) {
$mageRunCode = 'mobile'; // your store view code
}
Mage::run($mageRunCode, $mageRunType);
But nothing is helpful for me.
If anyone knows how to achieve this please write here.
My web URL is - https://www.anytimehydration.com