4

I saw this method as efective to detect if the user is using a mobile device:

$isMobile = Zend_Http_UserAgent_Mobile::match(
    Mage::helper('core/http')->getHttpUserAgent(),
    $_SERVER
);


But I was wondering where would be best to add this?

  • Did my solution helped/worked for you ? – Pawan Sep 23 '18 at 14:03
  • The code was in php and I needed to find it in html actually but for the asnwer I posted it would been appropriate. – Konstantin Patroev Sep 23 '18 at 18:31
1

You should put your code in a file which will available to all pages like

  • Header (app/design/frontend/{package }/{theme}/template/page/html/header.phtml)
  • Footer (app/design/frontend/{package }/{theme}/template/page/html/footer.phtml )

So you will be able to check $isMobile on all pages.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.