vue-adblock-detector

1.2.4 • Public • Published

vue-adblock-detector 🚫 🕵️

npm Language grade: JavaScript

This package was originally inspired copied from wmcmurray & BlockAdBlock & 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 vue-adblock-detector --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

import { detectAnyAdblocker } from 'vue-adblock-detector'

detectAnyAdblocker().then((detected) => {
  if(detected){
    // an adblocker is detected
  }
});

Browser

<script type="text/javascript" src="/dist/bundle.umd.js"></script>

<script type="text/javascript">
  justDetectAdblock.detectAnyAdblocker().then(function(detected) {
    if(detected){
      // an adblocker is detected
    }
  });
</script>

Package Sidebar

Install

npm i vue-adblock-detector

Weekly Downloads

2,635

Version

1.2.4

License

ISC

Unpacked Size

18.2 kB

Total Files

12

Last publish

Collaborators

  • gumbraise