I use something similar in all my projects that I build.
Sites with Adblock checking: (Enable/Disable your adblocker as needed to view header notice.)
http://www.mach-hosting.com/
http://www.supersimplecms.tk/
http://translate.supersimplecms.tk/
adblock_detector.css:
adblock_detector.js:
index.php:
You can easily customize it to use different text or other banners or images.
Sites with Adblock checking: (Enable/Disable your adblocker as needed to view header notice.)
http://www.mach-hosting.com/
http://www.supersimplecms.tk/
http://translate.supersimplecms.tk/
adblock_detector.css:
Code:
/* AdBlock Check */
{
display: none;
color: #ffffff;
}
{
text-align: center;
color: #F00;
font-family: Arial, Helvetica, sans-serif;
font-size: 18px;
background-color: #FF0;
}
{
text-align: center;
color: #000;
font-family: Arial, Helvetica, sans-serif;
font-size: 18px;
background-color: #093;
}
adblock_detector.js:
Code:
document.write('<div id="tester">test advertisement</div>');
index.php:
Code:
<!-- [START] - adblock check -->
<script type="text/javascript" src="assets/adblock_detector.js"></script>
<script type="text/javascript">
if (document.getElementById("tester") != undefined) {
//document.write('<div id="blocker_ok">No <strong>AdBlocker</strong> detected! Thanks for truly supporting our site!</div>');
} else {
document.write('<div id="blocker_alert">We have detected that you have an ad blocker enabled! Please disable it and help support our work!</div>');
}
</script>
<!-- [END] - adblock check -->
You can easily customize it to use different text or other banners or images.