Lock your content until the ad blocker is off.
BlockWall is one JavaScript file with no dependencies. It detects ad blockers and covers your page with a message until the visitor turns the blocker off for your site.
Your browser, right now
Checking…
Running the same checks BlockWall uses on your site.
How it detects a blocker
No single test catches every blocker, so BlockWall runs two and locks the page if either one fails.
- A bait element
- It adds a hidden box with class names like
ad-bannerandadsbox. Browser-extension blockers hide anything with those names, so a box that has no size means a blocker is active. - A bait request
- It requests a well-known ad script. DNS and network-level blockers refuse the request, so a failed request means a blocker is active. BlockWall skips this check when the browser is offline or the request times out.
- Re-checking
- BlockWall checks again when the visitor returns to the tab, when they press the button, and on a timer. The wall comes down by itself once the blocker is off, and goes back up if it is turned on again.
Install
Upload blockwall.js next to your pages. Put the content to lock inside one element and point target at it.
<script src="blockwall.js"></script>
<script>
AdBlockWall.init({
target: "#content",
mode: "blur",
title: "Please turn off your ad blocker"
});
</script>
Prefer no extra script block? Use <script src="blockwall.js" data-auto data-target="#content"></script>.
| Option | Default | What it does |
|---|---|---|
| target | body children | CSS selector of the content to lock. |
| mode | "blur" | "blur" leaves content visible but unreadable. "hide" hides it. |
| title, message | built in | The text shown on the wall. |
| buttonText | "I've turned it off" | Label of the button that re-checks. |
| networkCheck | true | Turn off if your Content Security Policy blocks outside requests. |
| recheckInterval | 15000 | Milliseconds between automatic checks. 0 turns them off. |
| onDetect, onClear | none | Callbacks for when the wall goes up and comes down. |
What it can't do
- It runs in the visitor's browser, so a determined visitor can remove the wall with developer tools or by turning off JavaScript. It stops casual skipping, not everyone. Content that must stay private belongs behind a server-side login.
- Detection is a best guess. A strict Content Security Policy, a flaky connection, or a privacy extension can cause a false alarm, so test on your own site and keep the button's message clear.
- Some visitors will leave instead of turning their blocker off. Ask politely and say what the ads pay for.
- Name the file something neutral like
blockwall.js. Some blocker lists block files with "ads" or "adblock" in the name, and then the wall never loads.