What is the best way to detect if user is a mobile user in code level?
Admin can set regex based rules to detect and switch themes based on user agent but seems like this functionality is "protected" inside api and is not available as a set of methods every developer can use.
I understand that devs and designers should arrange their functionality in theme folders to be available/unavailable but this is rather hard requirement for extension providers as the regex rules can be somewhat loosely defined and admin does not have to specify if a theme is intended for mobile users
So maybe someone has a good method to sniff this out from core already (without implementing stuff over again to be public instead protected that is already available core/design_package
)?
How about this? Seems to work pretty well for me.
$isMobile = Zend_Http_UserAgent_Mobile::match(
Mage::helper('core/http')->getHttpUserAgent(),
$_SERVER
);
Though I haven't done enough research, maybe the wurfl adapter is more robust, per this thread.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With