1

I am trying to remove certain dynamic script tags if the device is mobile. I have something like this to start with:

Vendor/MobileDetect/Helper/Data.php :

<?php

class Vendor_MobileDetect_Helper_Data
{
    public function isMobile() {
        $isMobile = Zend_Http_UserAgent_Mobile::match(
            Mage::helper('core/http')->getHttpUserAgent(),
            $_SERVER
        );
        return $isMobile;
    }
}

app/design/frontend/rwd/company/layout/local.xml :

<cms_index_index>
    <reference name="head">
        <action method="removeItem"><type>skin_js</type><name>nwdthemes/revslider/public/assets/js/jquery.themepunch.revolution.min.js</name><url helper="vendor_mobiledetect/isMobile"/></action>
</reference>
</cms_index_index>

The problem is that the function is removing the script tag for all devices (desktop, tablet, mobile). I just want it removed for mobile.

Thanks for any help!

Your Answer

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

Browse other questions tagged or ask your own question.