Ad blocker detection and page gating library for website developers.
Detects ad blockers using six parallel methods across all major browsers and hard-gates your page content until the visitor disables theirs. One script tag, zero dependencies, no backend required.
When a visitor loads your page with an ad blocker active, NoBarricade:
- Detects the ad blocker using up to six independent methods simultaneously
- Early-exits as soon as the sensitivity threshold is crossed — no waiting for slow methods
- Gates the entire page with a tamper-resistant overlay
- Waits until the visitor disables their ad blocker
- Re-verifies the claim by running all methods again before releasing the gate
- Continues monitoring on a configurable interval to catch mid-session activation
Six independent methods run in parallel. Any positive result (configurable via sensitivity) triggers the gate.
| Method | Key | How It Works | Catches |
|---|---|---|---|
| Bait Element | bait |
Injects a div with 35+ ad-targeting class names. Ad blockers apply display:none via cosmetic filters — NoBarricade measures the zero dimensions. |
uBlock Origin, AdGuard, Adblock Plus, Brave Shields |
| Multi-Network Fetch | fetch |
Probes 4 random URLs from a pool of 30+ ad network endpoints. All four must succeed to clear. One failure per probe is tolerated for CDN flakiness — all must fail. | All blockers including Pi-hole, NextDNS, AdGuard Home |
| Script Load | script |
Injects 2 script elements pointing to ad network JS files from different providers. onerror on either confirms blocking. |
uBlock Origin, AdGuard, Adblock Plus, Brave Shields |
| CSS Animation | css |
Applies a CSS animation to a bait element. display:none from cosmetic filters prevents animationstart from firing. Timeout = blocked. |
Brave Shields, AdGuard cosmetic, uBlock Origin cosmetic |
| Property Check | property |
Checks window globals from Google (google_ad_status, googletag), AppNexus (apntag), Taboola (_taboola), and Criteo (criteo_q). |
Effective when those specific ad scripts are loaded on the page |
| Brave API | brave |
Calls navigator.brave.isBrave() — a Promise exposed exclusively in Brave browser. Opt-in only, not in the default methods array. |
Brave (100M+ users) with Shields enabled |
| Ad Blocker | Type | Methods Used |
|---|---|---|
| uBlock Origin | Extension | bait fetch script css |
| Brave Shields | Browser built-in | fetch script css brave |
| AdGuard | Extension / App | bait fetch script css |
| Adblock Plus | Extension | bait fetch script |
| Pi-hole / AdGuard Home | DNS / Network | fetch script |
| NextDNS | DNS / Network | fetch script |
| Opera built-in | Browser built-in | bait fetch script css |
| Firefox ETP Strict | Browser built-in | fetch script |
| Samsung Internet (with blocker) | Browser + Extension | bait fetch script css |
| DuckDuckGo Browser | Browser built-in | fetch script |
| uBlock Origin Lite (Chrome MV3) | Extension (restricted) | bait css |
The fetch and script methods sample from endpoints across all major ad networks:
Google (AdSense, DoubleClick, GPT), AppNexus/Xandr, Criteo, Taboola, Outbrain, Amazon Ads, Rubicon Project, PubMatic, Index Exchange, OpenX, Sovrn/Lijit, Media.net, ShareThrough, Moat, TripleLift, Tribal Fusion, Adtech, Undertone, Revcontent, AdForm, and more.
<script src="https://cdn.jsdelivr.net/gh/hexadecinull/nobarricade@latest/nobarricade.js"></script>
<script>
NoBarricade.init();
</script>Download nobarricade.js from this repository and serve it from your own domain.
npm install nobarricadeimport NoBarricade from 'nobarricade';
NoBarricade.init();NoBarricade.init({
methods: ['bait', 'fetch', 'script', 'css', 'property'],
sensitivity: 1,
checkInterval: 3000,
detectionTimeout: 850,
overlay: {
title: 'Ad Blocker Detected',
message: 'This site relies on advertising to operate. Please disable your ad blocker to continue.',
buttonText: "I've Disabled My Ad Blocker — Continue",
steps: [
'Click the ad blocker icon in your browser toolbar.',
'Select "Disable" or "Pause" for this site.',
'Reload the page or click the button below.',
],
showSteps: true,
accentColor: '#c8953a',
brand: 'My Site',
logo: null,
},
protect: {
rejectContextMenu: true,
rejectKeyboardShortcuts: true,
lockScroll: true,
watchDevTools: true,
watchInterval: 750,
},
onDetected: function () {},
onCleared: function () {},
debug: false,
});All methods except detect() return NoBarricade for chaining.
NoBarricade.init(config?) // Initialize
NoBarricade.destroy() // Stop everything, remove overlay
NoBarricade.detect(cb) // Run detection once: cb(detected: boolean)
NoBarricade.check() // Trigger one pass, update gate state
NoBarricade.isGated() // → true if gate is currently showing
NoBarricade.isInitialized() // → true after init(), before destroy()
NoBarricade.forceGate() // Show the gate (testing)
NoBarricade.releaseGate() // Hide the gate (testing)| Browser | Minimum Version |
|---|---|
| Chrome | 66+ |
| Firefox | 63+ |
| Safari | 12.1+ |
| Edge | 79+ |
| Opera | 53+ |
| Opera GX | 60+ |
| Brave | 1.0+ |
| Firefox for Android | 63+ |
| Chrome for Android | 66+ |
| Samsung Internet | 8+ |
nobarricade/
├── index.html ← Documentation & landing page (GitHub Pages root)
├── demo.html ← Interactive demo with live controls
├── nobarricade.js ← Main library
├── README.md
└── LICENSE ← LGPL-3.0
- Create repo
hexadecinull/nobarricade - Push all files to
main - Settings → Pages → Source:
mainbranch,/ (root) - Live at
hexadecinull.github.io/nobarricade
GNU Lesser General Public License v3.0 — see LICENSE.
Built by SSMG4 / Hexadecinull