Skip to content


How to detect when a visitor is blocking ads

Again a draft that sat in the backlog for years.

Most simple version:
<script type="text/javascript">
var adblock = true;</script>
<script type="text/javascript" src="/js/adframe.js"></script>
<script type="text/javascript">if(adblock) {adsBlocked();}</script>

(adframe.js containing something like “adblock = false;“)
It’s not very sophisticated, and it surely won’t catch everything, but it will detect if a generic filter is in place on scripts named ad*.js and such.

Others:
http://adblockdetector.com/
http://www.saurdo.com/07/14/display-a-message-for-adblock-users
http://forrst.com/posts/How_to_detect_AdBlock_plug_ins-0Af

AdBlock counter:
http://www.saurdo.com/08/23/saurdo-adblock-counter/

Posted in published drafts, web development.


0 Responses

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.



Some HTML is OK

or, reply to this post via trackback.

Please solve the CAPTCHA below in order to fight spamWordPress CAPTCHA