XF 1.2 Show ads only to mobile users

tajhay

Well-known member
Hi guys,
Is there a conditional that i can use so that i only show ads to mobile users / people using the responsive format?

Greatly appreciated.
 
You can always use javascript user agent kind of stuff.

Code:
var isMobile = {
    Android: function() {
        return navigator.userAgent.match(/Android/i);
    },
    BlackBerry: function() {
        return navigator.userAgent.match(/BlackBerry/i);
    },
    iOS: function() {
        return navigator.userAgent.match(/iPhone|iPad|iPod/i);
    },
    Opera: function() {
        return navigator.userAgent.match(/Opera Mini/i);
    },
    Windows: function() {
        return navigator.userAgent.match(/IEMobile/i);
    },
    any: function() {
        return (isMobile.Android() || isMobile.BlackBerry() || isMobile.iOS() || isMobile.Opera() || isMobile.Windows());
    }
};

Then use conditionals...

Code:
if( isMobile.any() ) { do something };

or specific...

if( isMobile.iOS() )  { do something };
 
Top Bottom