{"id":370111,"date":"2023-02-24T04:26:50","date_gmt":"2023-02-24T04:26:50","guid":{"rendered":"https:\/\/webkul.com\/blog\/?p=370111"},"modified":"2023-05-01T11:30:57","modified_gmt":"2023-05-01T11:30:57","slug":"detect-the-mobile-devices-in-the-magento-as-zend_http_useragent_mobile-is-deprecated","status":"publish","type":"post","link":"https:\/\/webkul.com\/blog\/detect-the-mobile-devices-in-the-magento-as-zend_http_useragent_mobile-is-deprecated\/","title":{"rendered":"Detect the mobile devices in the Magento as Zend_Http_UserAgent_Mobile is deprecated."},"content":{"rendered":"\n<p>Hello Friends!!<\/p>\n\n\n\n<p>In today\u2019s blog, I will recommend a solution to detect mobile devices. As after <a href=\"https:\/\/experienceleague.adobe.com\/docs\/commerce-operations\/release\/notes\/magento-open-source\/2-4-4.html?lang=en\">Magento 2.4.4<\/a> Zend_Http_UserAgent_Mobile is deprecated.<\/p>\n\n\n\n<p>We will create a <a href=\"https:\/\/webkul.com\/blog\/magento-2-development-22-helper\/\">helper <\/a>with all the methods we need. And later we will use this helper in the block file. You can simply use the below code in your helper file.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\">&lt;?php\n\nnamespace Webkul\\DetectMobile\\Helper;\n\nclass Mobile\n{\n    \/**\n     * @var array\n     *\/\n    protected $_haTerms = &#091;\n        &#039;midp&#039;,\n        &#039;wml&#039;,\n        &#039;vnd.rim&#039;,\n        &#039;vnd.wap&#039;,\n        &#039;j2me&#039;,\n    ];\n\n    \/**\n     * User Agent Signatures\n     *\n     * @var array\n     *\/\n    protected $_uaSignatures = &#091;\n        &#039;iphone&#039;,\n        &#039;ipod&#039;,\n        &#039;ipad&#039;,\n        &#039;android&#039;,\n        &#039;blackberry&#039;,\n        &#039;opera mini&#039;,\n        &#039;opera mobi&#039;,\n        &#039;palm&#039;,\n        &#039;palmos&#039;,\n        &#039;elaine&#039;,\n        &#039;windows ce&#039;,\n        &#039;icab&#039;,\n        &#039;_mms&#039;,\n        &#039;ahong&#039;,\n        &#039;archos&#039;,\n        &#039;armv&#039;,\n        &#039;astel&#039;,\n        &#039;avantgo&#039;,\n        &#039;benq&#039;,\n        &#039;blazer&#039;,\n        &#039;brew&#039;,\n        &#039;com2&#039;,\n        &#039;compal&#039;,\n        &#039;danger&#039;,\n        &#039;pocket&#039;,\n        &#039;docomo&#039;,\n        &#039;epoc&#039;,\n        &#039;ericsson&#039;,\n        &#039;eudoraweb&#039;,\n        &#039;hiptop&#039;,\n        &#039;htc-&#039;,\n        &#039;htc_&#039;,\n        &#039;iemobile&#039;,\n        &#039;iris&#039;,\n        &#039;j-phone&#039;,\n        &#039;kddi&#039;,\n        &#039;kindle&#039;,\n        &#039;lg &#039;,\n        &#039;lg-&#039;,\n        &#039;lg\/&#039;,\n        &#039;lg;lx&#039;,\n        &#039;lge vx&#039;,\n        &#039;lge&#039;,\n        &#039;lge-&#039;,\n        &#039;lge-cx&#039;,\n        &#039;lge-lx&#039;,\n        &#039;lge-mx&#039;,\n        &#039;linux armv&#039;,\n        &#039;maemo&#039;,\n        &#039;midp&#039;,\n        &#039;mini 9.5&#039;,\n        &#039;minimo&#039;,\n        &#039;mob-x&#039;,\n        &#039;mobi&#039;,\n        &#039;mobile&#039;,\n        &#039;mobilephone&#039;,\n        &#039;mot 24&#039;,\n        &#039;mot-&#039;,\n        &#039;motorola&#039;,\n        &#039;n410&#039;,\n        &#039;netfront&#039;,\n        &#039;nintendo wii&#039;,\n        &#039;nintendo&#039;,\n        &#039;nitro&#039;,\n        &#039;nokia&#039;,\n        &#039;novarra-vision&#039;,\n        &#039;nuvifone&#039;,\n        &#039;openweb&#039;,\n        &#039;opwv&#039;,\n        &#039;palmsource&#039;,\n        &#039;pdxgw&#039;,\n        &#039;phone&#039;,\n        &#039;playstation&#039;,\n        &#039;polaris&#039;,\n        &#039;portalmmm&#039;,\n        &#039;qt embedded&#039;,\n        &#039;reqwirelessweb&#039;,\n        &#039;sagem&#039;,\n        &#039;sam-r&#039;,\n        &#039;samsu&#039;,\n        &#039;samsung&#039;,\n        &#039;sec-&#039;,\n        &#039;sec-sgh&#039;,\n        &#039;semc-browser&#039;,\n        &#039;series60&#039;,\n        &#039;series70&#039;,\n        &#039;series80&#039;,\n        &#039;series90&#039;,\n        &#039;sharp&#039;,\n        &#039;sie-m&#039;,\n        &#039;sie-s&#039;,\n        &#039;smartphone&#039;,\n        &#039;sony cmd&#039;,\n        &#039;sonyericsson&#039;,\n        &#039;sprint&#039;,\n        &#039;spv&#039;,\n        &#039;symbian os&#039;,\n        &#039;symbian&#039;,\n        &#039;symbianos&#039;,\n        &#039;telco&#039;,\n        &#039;teleca&#039;,\n        &#039;treo&#039;,\n        &#039;up.browser&#039;,\n        &#039;up.link&#039;,\n        &#039;vodafone&#039;,\n        &#039;vodaphone&#039;,\n        &#039;webos&#039;,\n        &#039;wml&#039;,\n        &#039;windows phone os 7&#039;,\n        &#039;wireless&#039;,\n        &#039;wm5 pie&#039;,\n        &#039;wms pie&#039;,\n        &#039;xiino&#039;,\n        &#039;wap&#039;,\n        &#039;up\/&#039;,\n        &#039;psion&#039;,\n        &#039;j2me&#039;,\n        &#039;klondike&#039;,\n        &#039;kbrowser&#039;\n    ];\n\n    \/**\n     * first 4 letters of mobile User Agent chains\n     *\n     * @var array\n     *\/\n    protected $_uaBegin = &#091;\n        &#039;w3c &#039;,\n        &#039;acs-&#039;,\n        &#039;alav&#039;,\n        &#039;alca&#039;,\n        &#039;amoi&#039;,\n        &#039;audi&#039;,\n        &#039;avan&#039;,\n        &#039;benq&#039;,\n        &#039;bird&#039;,\n        &#039;blac&#039;,\n        &#039;blaz&#039;,\n        &#039;brew&#039;,\n        &#039;cell&#039;,\n        &#039;cldc&#039;,\n        &#039;cmd-&#039;,\n        &#039;dang&#039;,\n        &#039;doco&#039;,\n        &#039;eric&#039;,\n        &#039;hipt&#039;,\n        &#039;inno&#039;,\n        &#039;ipaq&#039;,\n        &#039;java&#039;,\n        &#039;jigs&#039;,\n        &#039;kddi&#039;,\n        &#039;keji&#039;,\n        &#039;leno&#039;,\n        &#039;lg-c&#039;,\n        &#039;lg-d&#039;,\n        &#039;lg-g&#039;,\n        &#039;lge-&#039;,\n        &#039;maui&#039;,\n        &#039;maxo&#039;,\n        &#039;midp&#039;,\n        &#039;mits&#039;,\n        &#039;mmef&#039;,\n        &#039;mobi&#039;,\n        &#039;mot-&#039;,\n        &#039;moto&#039;,\n        &#039;mwbp&#039;,\n        &#039;nec-&#039;,\n        &#039;newt&#039;,\n        &#039;noki&#039;,\n        &#039;palm&#039;,\n        &#039;pana&#039;,\n        &#039;pant&#039;,\n        &#039;phil&#039;,\n        &#039;play&#039;,\n        &#039;port&#039;,\n        &#039;prox&#039;,\n        &#039;qwap&#039;,\n        &#039;sage&#039;,\n        &#039;sams&#039;,\n        &#039;sany&#039;,\n        &#039;sch-&#039;,\n        &#039;sec-&#039;,\n        &#039;send&#039;,\n        &#039;seri&#039;,\n        &#039;sgh-&#039;,\n        &#039;shar&#039;,\n        &#039;sie-&#039;,\n        &#039;siem&#039;,\n        &#039;smal&#039;,\n        &#039;smar&#039;,\n        &#039;sony&#039;,\n        &#039;sph-&#039;,\n        &#039;symb&#039;,\n        &#039;t-mo&#039;,\n        &#039;teli&#039;,\n        &#039;tim-&#039;,\n        &#039;tosh&#039;,\n        &#039;tsm-&#039;,\n        &#039;upg1&#039;,\n        &#039;upsi&#039;,\n        &#039;vk-v&#039;,\n        &#039;voda&#039;,\n        &#039;wap-&#039;,\n        &#039;wapa&#039;,\n        &#039;wapi&#039;,\n        &#039;wapp&#039;,\n        &#039;wapr&#039;,\n        &#039;webc&#039;,\n        &#039;winw&#039;,\n        &#039;winw&#039;,\n        &#039;xda&#039;,\n        &#039;xda-&#039;,\n    ];\n\n    \/**\n     * Comparison of the UserAgent chain and User Agent signatures\n     *\n     * @param  string $userAgent User Agent chain\n     * @param  array $server $_SERVER like param\n     * @return bool\n     *\/\n    public function match($userAgent, $server)\n    {\n        \/\/  To have a quick identification, try light-weight tests first\n        if (isset($server&#091;&#039;all_http&#039;])) {\n            if (strpos(strtolower(str_replace(&#039; &#039;, &#039;&#039;, $server&#091;&#039;all_http&#039;])), &#039;operam&#039;) !== false) {\n                \/\/ Opera Mini or Opera Mobi\n                return true;\n            }\n        }\n\n        if (isset($server&#091;&#039;http_x_wap_profile&#039;]) || isset($server&#091;&#039;http_profile&#039;])) {\n            return true;\n        }\n\n        if (isset($server&#091;&#039;http_accept&#039;])) {\n            if ($this-&gt;matchAgentAgainstSignatures($server&#091;&#039;http_accept&#039;], $this-&gt;_haTerms)) {\n                return true;\n            }\n        }\n\n        if ($this-&gt;userAgentStart($userAgent)) {\n            return true;\n        }\n\n        if ($this-&gt;matchAgentAgainstSignatures($userAgent, $this-&gt;_uaSignatures)) {\n            return true;\n        }\n\n        return false;\n    }\n\n    \/**\n     * Match a user agent string against a list of signatures\n     *\n     * @param  string $userAgent\n     * @param  array $signatures\n     * @return bool\n     *\/\n    protected function matchAgentAgainstSignatures($userAgent, $signatures)\n    {\n        $userAgent = strtolower($userAgent);\n        foreach ($signatures as $signature) {\n            if (!empty($signature)) {\n                if (strpos($userAgent, $signature) !== false) {\n                    \/\/ Browser signature was found in user agent string\n                    return true;\n                }\n            }\n        }\n        return false;\n    }\n\n    \/**\n     * Retrieve beginning clause of user agent\n     *\n     * @param  string $userAgent\n     * @return string\n     *\/\n    public function userAgentStart($userAgent)\n    {\n\n        $mobile_ua = strtolower(substr($userAgent, 0, 4));\n\n        return (in_array($mobile_ua, $this-&gt;_uaBegin));\n    }\n}\n?&gt;<\/pre>\n\n\n\n<p>Now we will create the block file and will use the helper which we created earlier to check if it&#8217;s a <a href=\"https:\/\/store.webkul.com\/magento2-mobile-app.html\">mobile <\/a>device or not.<\/p>\n\n\n\n<p>You can simply use the below code in your block file.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\">&lt;?php\n\nnamespace Webkul\\DetectMobile\\Block;\n\nclass DetectMobile extends \\Magento\\Framework\\View\\Element\\Template\n{\n    \/**\n     * @var \\Webkul\\DetectMobile\\Helper\\Mobile\n     *\/\n    protected $mobile;\n\n    \/**\n     * @param \\Magento\\Framework\\View\\Element\\Template\\Context $context\n     * @param \\Webkul\\DetectMobile\\Helper\\Mobile $Mobile\n     * @param array $data\n     *\/\n    public function __construct(\n        \\Magento\\Framework\\View\\Element\\Template\\Context $context,\n        \\Magento\\Framework\\HTTP\\Header $httpHeader,\n        \\Webkul\\DetectMobile\\Helper\\Mobile $mobile,\n        array $data = &#091;]\n    ) {\n        $this-&gt;httpHeader = $httpHeader;\n        $this-&gt;mobile = $mobile;\n        parent::__construct($context, $data);\n    }\n\n    \/**\n     * Is Mobile\n     *\n     * @return bool\n     *\/\n    public function Ismobile()\n    {\n        $userAgent = $this-&gt;httpHeader-&gt;getHttpUserAgent();\n        $server = $this-&gt;getRequest()-&gt;getServer();\n        $isMobileDevice = $this-&gt;mobile-&gt;match($userAgent, $server);\n        return $isMobileDevice;\n    }\n}\n?&gt;<\/pre>\n\n\n\n<p>Now, the method <a href=\"https:\/\/webkul.com\/blog\/how-to-detect-the-mobile-devices-in-the-latest-magento-as-zend_http_useragent_mobile-is-deprecated\/\">Ismobile<\/a>() will return the desired result. <\/p>\n\n\n\n<p>That\u2019s all about detecting the mobile without <a href=\"https:\/\/devdocs.magento.com\/\"> Zend_Http_UserAgent<\/a> Hope this will be helpful.<\/p>\n\n\n\n<p>If you have any questions please comment below, and we will try to respond to you.<\/p>\n\n\n\n<p>Thanks! \ud83d\ude42<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Hello Friends!! In today\u2019s blog, I will recommend a solution to detect mobile devices. As after Magento 2.4.4 Zend_Http_UserAgent_Mobile is deprecated. We will create a helper with all the methods we need. And later we will use this helper in the block file. You can simply use the below code in your helper file. Now <a href=\"https:\/\/webkul.com\/blog\/detect-the-mobile-devices-in-the-magento-as-zend_http_useragent_mobile-is-deprecated\/\">[&#8230;]<\/a><\/p>\n","protected":false},"author":430,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8,9121],"tags":[13643,13642,2070],"class_list":["post-370111","post","type-post","status-publish","format-standard","hentry","category-magento","category-magento-2","tag-deprecated-zend_http_useragent_mobile","tag-detect-mobile-devices-in-magento-2","tag-magento2"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v24.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Detect mobile devices in magento 2<\/title>\n<meta name=\"description\" content=\"How to detect the mobile devices in the latest Magento as Zend_Http_UserAgent_Mobile is deprecated. Detect mobile devices in magento 2\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/webkul.com\/blog\/detect-the-mobile-devices-in-the-magento-as-zend_http_useragent_mobile-is-deprecated\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Detect mobile devices in magento 2\" \/>\n<meta property=\"og:description\" content=\"How to detect the mobile devices in the latest Magento as Zend_Http_UserAgent_Mobile is deprecated. Detect mobile devices in magento 2\" \/>\n<meta property=\"og:url\" content=\"https:\/\/webkul.com\/blog\/detect-the-mobile-devices-in-the-magento-as-zend_http_useragent_mobile-is-deprecated\/\" \/>\n<meta property=\"og:site_name\" content=\"Webkul Blog\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/webkul\/\" \/>\n<meta property=\"article:published_time\" content=\"2023-02-24T04:26:50+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-05-01T11:30:57+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-og.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"630\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Shweta Singh\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@webkul\" \/>\n<meta name=\"twitter:site\" content=\"@webkul\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Shweta Singh\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/webkul.com\/blog\/detect-the-mobile-devices-in-the-magento-as-zend_http_useragent_mobile-is-deprecated\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/webkul.com\/blog\/detect-the-mobile-devices-in-the-magento-as-zend_http_useragent_mobile-is-deprecated\/\"},\"author\":{\"name\":\"Shweta Singh\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/person\/2aa9e6c8f634365b94451ac7a636a444\"},\"headline\":\"Detect the mobile devices in the Magento as Zend_Http_UserAgent_Mobile is deprecated.\",\"datePublished\":\"2023-02-24T04:26:50+00:00\",\"dateModified\":\"2023-05-01T11:30:57+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/webkul.com\/blog\/detect-the-mobile-devices-in-the-magento-as-zend_http_useragent_mobile-is-deprecated\/\"},\"wordCount\":149,\"commentCount\":4,\"publisher\":{\"@id\":\"https:\/\/webkul.com\/blog\/#organization\"},\"keywords\":[\"deprecated Zend_Http_UserAgent_Mobile\",\"Detect mobile devices in magento 2\",\"Magento2\"],\"articleSection\":[\"magento\",\"Magento 2\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/webkul.com\/blog\/detect-the-mobile-devices-in-the-magento-as-zend_http_useragent_mobile-is-deprecated\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/webkul.com\/blog\/detect-the-mobile-devices-in-the-magento-as-zend_http_useragent_mobile-is-deprecated\/\",\"url\":\"https:\/\/webkul.com\/blog\/detect-the-mobile-devices-in-the-magento-as-zend_http_useragent_mobile-is-deprecated\/\",\"name\":\"Detect mobile devices in magento 2\",\"isPartOf\":{\"@id\":\"https:\/\/webkul.com\/blog\/#website\"},\"datePublished\":\"2023-02-24T04:26:50+00:00\",\"dateModified\":\"2023-05-01T11:30:57+00:00\",\"description\":\"How to detect the mobile devices in the latest Magento as Zend_Http_UserAgent_Mobile is deprecated. Detect mobile devices in magento 2\",\"breadcrumb\":{\"@id\":\"https:\/\/webkul.com\/blog\/detect-the-mobile-devices-in-the-magento-as-zend_http_useragent_mobile-is-deprecated\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/webkul.com\/blog\/detect-the-mobile-devices-in-the-magento-as-zend_http_useragent_mobile-is-deprecated\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/webkul.com\/blog\/detect-the-mobile-devices-in-the-magento-as-zend_http_useragent_mobile-is-deprecated\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/webkul.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Detect the mobile devices in the Magento as Zend_Http_UserAgent_Mobile is deprecated.\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/webkul.com\/blog\/#website\",\"url\":\"https:\/\/webkul.com\/blog\/\",\"name\":\"Webkul Blog\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/webkul.com\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/webkul.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/webkul.com\/blog\/#organization\",\"name\":\"WebKul Software Private Limited\",\"url\":\"https:\/\/webkul.com\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png\",\"contentUrl\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png\",\"width\":380,\"height\":380,\"caption\":\"WebKul Software Private Limited\"},\"image\":{\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/webkul\/\",\"https:\/\/x.com\/webkul\",\"https:\/\/www.instagram.com\/webkul\/\",\"https:\/\/www.linkedin.com\/company\/webkul\",\"https:\/\/www.youtube.com\/user\/webkul\/\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/person\/2aa9e6c8f634365b94451ac7a636a444\",\"name\":\"Shweta Singh\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/51b8ea403cd7931cc8ef43d9b80e04e02143fd85bae4fe4ff866790408fb82d0?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Feva.png&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/51b8ea403cd7931cc8ef43d9b80e04e02143fd85bae4fe4ff866790408fb82d0?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Feva.png&r=g\",\"caption\":\"Shweta Singh\"},\"url\":\"https:\/\/webkul.com\/blog\/author\/shweta-singh342\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Detect mobile devices in magento 2","description":"How to detect the mobile devices in the latest Magento as Zend_Http_UserAgent_Mobile is deprecated. Detect mobile devices in magento 2","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/webkul.com\/blog\/detect-the-mobile-devices-in-the-magento-as-zend_http_useragent_mobile-is-deprecated\/","og_locale":"en_US","og_type":"article","og_title":"Detect mobile devices in magento 2","og_description":"How to detect the mobile devices in the latest Magento as Zend_Http_UserAgent_Mobile is deprecated. Detect mobile devices in magento 2","og_url":"https:\/\/webkul.com\/blog\/detect-the-mobile-devices-in-the-magento-as-zend_http_useragent_mobile-is-deprecated\/","og_site_name":"Webkul Blog","article_publisher":"https:\/\/www.facebook.com\/webkul\/","article_published_time":"2023-02-24T04:26:50+00:00","article_modified_time":"2023-05-01T11:30:57+00:00","og_image":[{"width":1200,"height":630,"url":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-og.png","type":"image\/png"}],"author":"Shweta Singh","twitter_card":"summary_large_image","twitter_creator":"@webkul","twitter_site":"@webkul","twitter_misc":{"Written by":"Shweta Singh","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/webkul.com\/blog\/detect-the-mobile-devices-in-the-magento-as-zend_http_useragent_mobile-is-deprecated\/#article","isPartOf":{"@id":"https:\/\/webkul.com\/blog\/detect-the-mobile-devices-in-the-magento-as-zend_http_useragent_mobile-is-deprecated\/"},"author":{"name":"Shweta Singh","@id":"https:\/\/webkul.com\/blog\/#\/schema\/person\/2aa9e6c8f634365b94451ac7a636a444"},"headline":"Detect the mobile devices in the Magento as Zend_Http_UserAgent_Mobile is deprecated.","datePublished":"2023-02-24T04:26:50+00:00","dateModified":"2023-05-01T11:30:57+00:00","mainEntityOfPage":{"@id":"https:\/\/webkul.com\/blog\/detect-the-mobile-devices-in-the-magento-as-zend_http_useragent_mobile-is-deprecated\/"},"wordCount":149,"commentCount":4,"publisher":{"@id":"https:\/\/webkul.com\/blog\/#organization"},"keywords":["deprecated Zend_Http_UserAgent_Mobile","Detect mobile devices in magento 2","Magento2"],"articleSection":["magento","Magento 2"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/webkul.com\/blog\/detect-the-mobile-devices-in-the-magento-as-zend_http_useragent_mobile-is-deprecated\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/webkul.com\/blog\/detect-the-mobile-devices-in-the-magento-as-zend_http_useragent_mobile-is-deprecated\/","url":"https:\/\/webkul.com\/blog\/detect-the-mobile-devices-in-the-magento-as-zend_http_useragent_mobile-is-deprecated\/","name":"Detect mobile devices in magento 2","isPartOf":{"@id":"https:\/\/webkul.com\/blog\/#website"},"datePublished":"2023-02-24T04:26:50+00:00","dateModified":"2023-05-01T11:30:57+00:00","description":"How to detect the mobile devices in the latest Magento as Zend_Http_UserAgent_Mobile is deprecated. Detect mobile devices in magento 2","breadcrumb":{"@id":"https:\/\/webkul.com\/blog\/detect-the-mobile-devices-in-the-magento-as-zend_http_useragent_mobile-is-deprecated\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/webkul.com\/blog\/detect-the-mobile-devices-in-the-magento-as-zend_http_useragent_mobile-is-deprecated\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/webkul.com\/blog\/detect-the-mobile-devices-in-the-magento-as-zend_http_useragent_mobile-is-deprecated\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/webkul.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Detect the mobile devices in the Magento as Zend_Http_UserAgent_Mobile is deprecated."}]},{"@type":"WebSite","@id":"https:\/\/webkul.com\/blog\/#website","url":"https:\/\/webkul.com\/blog\/","name":"Webkul Blog","description":"","publisher":{"@id":"https:\/\/webkul.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/webkul.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/webkul.com\/blog\/#organization","name":"WebKul Software Private Limited","url":"https:\/\/webkul.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png","contentUrl":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png","width":380,"height":380,"caption":"WebKul Software Private Limited"},"image":{"@id":"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/webkul\/","https:\/\/x.com\/webkul","https:\/\/www.instagram.com\/webkul\/","https:\/\/www.linkedin.com\/company\/webkul","https:\/\/www.youtube.com\/user\/webkul\/"]},{"@type":"Person","@id":"https:\/\/webkul.com\/blog\/#\/schema\/person\/2aa9e6c8f634365b94451ac7a636a444","name":"Shweta Singh","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/webkul.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/51b8ea403cd7931cc8ef43d9b80e04e02143fd85bae4fe4ff866790408fb82d0?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Feva.png&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/51b8ea403cd7931cc8ef43d9b80e04e02143fd85bae4fe4ff866790408fb82d0?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Feva.png&r=g","caption":"Shweta Singh"},"url":"https:\/\/webkul.com\/blog\/author\/shweta-singh342\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/370111","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/users\/430"}],"replies":[{"embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/comments?post=370111"}],"version-history":[{"count":9,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/370111\/revisions"}],"predecessor-version":[{"id":379194,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/370111\/revisions\/379194"}],"wp:attachment":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/media?parent=370111"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/categories?post=370111"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/tags?post=370111"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}