Detecting AdBlocking software?

前端 未结 10 1422
梦谈多话
梦谈多话 2020-12-13 01:10

I was recently visiting a site and noticed that the page had a section that said it noticed that I was using AdBlocking software and could I kindly turn it off to help suppo

10条回答
  •  不思量自难忘°
    2020-12-13 01:55

    I believe that is much easier to do it on client side than in server side. Ad blockers are installed on the client, so they can manipulate DOM and block ajax requests. That's why I believe it makes more sense to detect on the client than on the server.

    Anyway, this is a standalone simple plugin that detects users with ad blockers enabled, it's open-source and the full code is on github:

    https://github.com/retargetly/mockingbird

    It's more publisher oriented so they can easily show messages on the ads containers or in a popup. The plugin is frequently updated, and it's worth a try. This is the fiddle also:

    http://jsfiddle.net/retargetly/9vsha32h/

    The only method you need to use is

    mockingbird.adsBlocked(Obj)
    

    The call can be done anywhere in the code and you don't need jQuery to make it work.

    Wish you luck !

提交回复
热议问题