Detecting AdBlocking software?

前端 未结 10 1416
梦谈多话
梦谈多话 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:36

    All off the methods mentioned here rely on the ad blockers to strip out code. This doesn't work for some adblockers(like NetBarrier on Mac). You also have to keep updating your code when the adblockers catch on.

    To detect if the user is blocking ads, all you have to do is find a function in the ad javascript and try testing for it. It doesn't matter what method they're using to block the ad. Here's what it looks like for Google Adsense ads:

    if(typeof(window.google_render_ad)=="undefined") 
    { 
        //They're blocking ads, do something else.
    }
    

    This method is outlined here: http://www.metamorphosite.com/detect-web-popup-blocker-software-adblock-spam

提交回复
热议问题