I have used below code to detect mobile in magento1.
$isMobile = Zend_Http_UserAgent_Mobile::match(
Mage::helper('core/http')->getHttpUserAgent(),
$_SERVER
);
I am not sure if there is something available for Magento2 as well. Anyone have used something like this in magento2?
Best Answer
Best way is to detect a mobile device is
I have used this in many websites and working perfect.