Some bloggers like me maybe so pissed to know that our ad revenue is decreasing dramatically after introduction of Ad blocking plugin (like AdBlock/Adblock Plus, etc). But lucky I found a way to ask the audience to disable the plugin when detected. In this case, I used jQuery to detect adBlock.
I used JQuery to detect ad blocking plugin for my other website. Here’s the code I used:
First, I put my ads inside a DIV, and name it “yourcode”.
<div id="yourcode"><!-- your ad code ---></div>
And put this code just below it:
<script type="text/javascript">
jQuery(document).ready(function(){
if (jQuery('#yourcode').height() == 0) {
alert('ADBLOCK IS ACTIVE!');
}
});
</script>
That’s the simple detection method. But, you can change the code above as per your need.
For example, I edited the code in andiim3.com to hide some contents (download links) when the code detected adBlock and show a dialog asking audience to disable the ad blocking plugin.
I put extra code just after “alert()” to trigger some action after audience clicked the “OK” button.
Need help? Leave a comment below..
Dobby and Luna have been part of our lives for the past years. They have…
In the year 2021, I've completed some paid projects. Some of them are more technical,…
Based on the GlassTime Bootstrap template, here I present glassmorphism WordPress Theme free to download.This…
This HTML5 template is using Glassmorphism UI design language which is now trending for 2021…
KecamatanKode POSBanjar81152Buleleng81119Busungbiu81154Gerokgak81155Kubutambahan81172Sawan81171Seririt81153Sukasada81161Tejakula81173Klik pada nama kecamatan untuk melihat daftar desa masing-masing. Sumber: kodepos.andiim3.com
Ada yang bilang "semuanya akan mati matic pada akhirnya". Bener aja, sekarang tuntutan transportasi sehari-hari…
This website uses cookies.