Ad Blocker detection AKA Adblock Plus

前端 未结 15 1418
北海茫月
北海茫月 2020-12-02 06:14

After searching Google and Stackoverflow for a few hours I could not find a solution. What I\'m trying to do is detect Adblock plus and display a simple message for now.

15条回答
  •  广开言路
    2020-12-02 06:26

    You don't need to have a plugin to detect adblock, simply use this:

    
    
    
    

    Content of adframe.js:

    adblock = false;
    

    Update: Adblock Plus blocks certain requests or hides certain elements based on patterns it already has. One of those patterns is this (in patterns.ini):

    [Filter]
    text=/adframe.
    hitCount=843
    lastHit=1456391595626
    

    which blocks any URL that has /adframe. in it.

    Update 25th august 2018

    Adblock plus has changed the way it finds the list and blocks the ads. It has bunch of lists called subscriptions which are used for blocking. For example this one which is the default one:

    https://easylist-downloads.adblockplus.org/easylist.txt

    You can use the rules on this file to find a file name to use. For example you can use seo-ads.js

    P.S for developers: For some reason I couldn't get ABP to block these files on local environment.

    P.S: ABP is my favorite ad blocker :-D

提交回复
热议问题