https://github.com/wmcmurray/just-detect-adblock
It's FuckAdBlock with a minimalist API.
https://github.com/wmcmurray/just-detect-adblock
adblock adblocker adblocking braveshields fuckadblock
Last synced: 6 months ago
JSON representation
It's FuckAdBlock with a minimalist API.
- Host: GitHub
- URL: https://github.com/wmcmurray/just-detect-adblock
- Owner: wmcmurray
- Created: 2017-03-25T14:53:05.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2020-10-29T05:00:24.000Z (over 5 years ago)
- Last Synced: 2025-08-20T14:15:31.237Z (11 months ago)
- Topics: adblock, adblocker, adblocking, braveshields, fuckadblock
- Language: JavaScript
- Homepage: https://wmcmurray.github.io/just-detect-adblock/
- Size: 32.2 KB
- Stars: 85
- Watchers: 5
- Forks: 14
- Open Issues: 11
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-rainmana - wmcmurray/just-detect-adblock - It's FuckAdBlock with a minimalist API. (JavaScript)
README
# just-detect-adblock :no_entry_sign: :detective:
[](https://www.npmjs.com/package/just-detect-adblock)
[](https://lgtm.com/projects/g/wmcmurray/just-detect-adblock/context:javascript)
[](https://wmcmurray.github.io/just-detect-adblock/)
This package was originally ~~inspired~~ copied from [BlockAdBlock](https://github.com/sitexw/BlockAdBlock) & [FuckAdBlock](https://github.com/sitexw/FuckAdBlock), then I added features that those don't have. I just didn't like how overly complicated their API was, so I made this, which contains only helper functions that can be called manually. The rest is up to you !
## Features
- **Browser extensions** detection (like **AdBlock, Adblock Plus, uBlock, etc.**)
- **Brave browser** shields detection
- **Opera browser** adblocker detection
## How to use
```
npm install just-detect-adblock --save
```
| Methods | Return | Description |
| :---------------------------- | :------------------------------ | :------------------------------------------------------------------|
| `detectAnyAdblocker()` | *Promise(detected=true/false)* | perform all available checks below until at least one is positive |
| `detectDomAdblocker()` | *Promise(detected=true/false)* | detect if a browser extension is hiding ads from the DOM |
| `detectBraveShields()` | *Promise(detected=true/false)* | detect if Brave browser shields seems to be activated |
| `detectOperaAdblocker()` | *Promise(detected=true/false)* | detect if Opera browser adblocker seems to be activated |
| **DEPRECATED** `isDetected()` | *true/false* | if an adblocker is detected **(old behavior only, this method does not detect Brave or Opera adblockers, please use `detectAnyAdblocker` instead)** |
## Exemples
### Webpack
```javascript
import { detectAnyAdblocker } from 'just-detect-adblock'
detectAnyAdblocker().then((detected) => {
if(detected){
// an adblocker is detected
}
});
```
### Browser
```html
justDetectAdblock.detectAnyAdblocker().then(function(detected) {
if(detected){
// an adblocker is detected
}
});
```