Disallow visitors with adblockers to see your content

After following a very interesting thread on google plus with regard to people using adblockers while visiting sites on the internet, I’ve realised that so many people simply don’t understand that some of us actually make a living, as humble as it may be, by displaying ads on our sites.

And according to some of the comments there, visiting a site that uses ads to support the site owner’s work while using adblockers to get their content, but not the ads on their sites, to be displayed in your browsers, is THEFT at best, and I completely agree with it.


It is the website owner’s right to use tools that make sure that a visitor that consumes  the content (yeah, that’s consumption too, reading an article, even the comments on a site… it’s content, you consume it by reading, commenting, interacting with it), will also see the ads. Whether they also interact in any other way with the ads, is a whole another topic altogether, but as one of the commenters in the aforementioned g+ thread pointed out, displaying of the ads is crucial.

So, since I’ve been using a script that keeps visitors from seeing the content on any site or blog, if they are using script blockers, since adblock plus and adblockers in general appeared a few years ago, I suggest those webmasters, site owners who use their ad spaces consciously, respectfully, and adhering to the network advertising initiatives set forth by google and other *respectful* advertising networks, use the following little script to make sure that only those who allow displaying of the ads will also see the articles, images, etc., generally, the content of their blogs.

I use this script on all blogspot blogs I manage, and since I’ve started using it, the number of visitors did increase a little, and the fact that I’ve seen in my stats that even a huge drop in bouncerate occured, I can only state the obvious: visitors interested in your content are NOT disturbed or bothered by ads, on the contrary, if the ad network you’re part of, such as adsense, does its job well, your visitors might actually find new and interesting content relevant to them, exactly through the ads. It’s a win-win kinda’ thing.

So here’s how you can disallow visitors with adblockers from seeing your content.

The script needs to be implemented immediately after the opening <body statament in the template, regardless of the blog’s platform (wordpress, blogger, etc.), so you need to have access to the template files.

Edit your template and insert this little code immediately after the<body statement:

<style type=’text/css’>
.pagecontainer {display:none;}
.noscriptmsg { width:65%; text-align:center;word-wrap:break-word;position:fixed;top:200px;left:200px;}
<center><div class=’noscriptmsg’>
      Dear visitor, thank you for your interest in my content ! I’ve detected that you run an adblock to keep ads from showing on my site, but since those ads support my work and the creation of the content on this site, I cannot allow you to see that content, since consuming my content without allowing me to be payed for it, is considered theft. Please disable your adblocker if you’d still like to see the content on this site, or feel free to navigate elsewhere. Thank you for your understanding and have a nice day 🙂

Of course, feel free to adjust the message to better suit you. And all your content in the template needs to come after this div.

Now, there are two more things after inserting this script in your template, that you need to do to make it work.

1. The bolded “.pagecontainer” CSS selector obviously needs to exist, so , you encapsulate ALL your content that comes AFTER the script in a DIV that will have the class=”pagecontainer” option set.

So immediately after the above script portion, you insert this line into your template:

<div class=’pagecontainer’>

2. You insert the closing tag of this div, IMMEDIATELY BEFORE the closing </body> tag in your template, so it will become :


And that’s it. You can easily perform a little test, install adblockplus or some other adblocker in your browser, and visit any page on your site or blog, it should immediately alert you with the message you’ve inserted in the “noscriptmsg” div.

Obviously, this script relies on the fact that usually adblockers disable the displaying of javascript on sites, so, this will be faulty maybe in the way that any browser with javascript turned off, will be detected as blocking ads, which is consequently true.

If you only wish to detect browsers specifically blocking adwords/adsense ads, you can use this little script, ,inserting it immediately before the </body> tag in your template:

alert(“Please disable adblockers to see the content”);

document.write(“<style type=’text/css’>.pagecontainer{display:none;}</style>”);


If you can’t succeed in implementing this, or simply don’t know how to do it, leave a comment and I’ll do my best to help you.

On the other hand, if you did succeed implementing it, and you think this post was/is useful, please share it with your favorite social circle, friends, coworkers, like-minded individuals, so their sites and their work might benefit as well from more interested, more engaged visitors who do support their work by allowing ads to display instead of blocking them.