last updated : Apr 13 2016

anti-contentBlocker.js installation guide

Download

Installation

  1. Unzip downloaded .zip file.
    You will find the folder named 'anti-contentBlocker'.
  2. Upload entire 'anti-contentBlocker' folder to your web server.
  3. Inside the <head> section of the page, add the following code :
    <link rel="stylesheet" href="path_to_file/anti-contentBlocker.css">
    <script src="path_to_file/anti-contentBlocker.js"></script>
    <script>
    window.addEventListener( 'load', __acb.detectBlocker, false );
    </script>
    • path_to_file : path to anti-contentBlocker.js / anti-contentBlocker.css
You could change the folder name (anti-contentBlocker)and/or the file name of JavaScript (anti-contentBlocker.js) and/or CSS (anti-contentBlocker.css) if you wish.

How it works

Anti-contentBlocker.js counts the number of IFRAME elements inside Google AdSense code (that have an class name of "adsbygoogle") when the web page has been fully loaded. (How and why)

For this reason, there must be at least one Google AdSense code in your web page.

I think Ads provided by other Ads platforms could be the target of anti-contentBlocker.js.

You can edit parameters: 'targetClassName', 'targetElement' and/or 'threshold' in anti-contentBlocker.js source code to fit to your environment.

If AdBlocker was detected, it displays the following message.

If the browser language is set to Japanese (ja or ja-JP), the message will be displayed in Japanese. Except Japanese, in English.

Notes

Browser Requirements

I had tested the following conditions:

anti-contentBlocker.js might be affected by the page structure, behavior of the Ads code, and/or the other JavaScript. And it might NOT be true the fact: "a Google AdSense code will always append IFRAME elements to its INS element when it has been executed successfully." that is the essential part of anti-contentBlocker.js.

Unfortunately, I can not test all these conditions. But in my environment, it works well and it is enough for me.

Please contact me if you have anything questions.