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?

2
  • Did my solution helped/worked for you ?
    – Pawan
    Commented Sep 23, 2018 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. Commented Sep 23, 2018 at 18:31

1 Answer 1

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 and acknowledge you have read our privacy policy.

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