Alert AdBlock users about adblock extension
#1
Information 
Alert to Adblock Users to deactivate extension.
YOu can insert this code on your HEADERINCLUDE --> load every page or on your HEADER / HEADER_GUEST...or INDEX --> Only main page

I'm not a programmer, I just gathered a few pieces around

<div class="YOUR_CLASS">Alerts!&nbsp;</div> // - You can remove this
<script>
(function() {
    var message = "Your Message to AdBlock Users!";
    var tryMessage = function() {
            setTimeout(function() {
                if(!document.getElementsByClassName) return;
                var ads = document.getElementsByClassName('YOUR_CLASS'),
                    ad  = ads[ads.length - 1];
  if(!ad
                    || ad.innerHTML.length == 0
                    || ad.clientHeight === 0) {
                    alert(message);
                 //window.location.href = 'http://comunidade.bf4brasil.com.br/member.php?action=register'; "//"  Redirect users to where you want - You need to remove "//"
                } else {
                    ad.style.display = 'none';
                }

            }, 1800);
        }
        if(window.addEventListener) {
            window.addEventListener('load', tryMessage, false);
        } else {
            window.attachEvent('onload', tryMessage);
        }
})();
</script>
[Image: 468x60_bf4brasil_site_zpsd7eefd7f.png]
Reply


Messages In This Thread
Alert AdBlock users about adblock extension - by dthiago - 2014-06-01, 12:42 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)