Block all content on a web page for people using an Adblock-type browser add-on/extension?

有些话、适合烂在心里 提交于 2020-01-02 23:08:09

问题


I wish to block ALL my content from any users using an ad-blocking browser extension (ie. Adblock Plus for Firefox, Adthwart for Chrome).

How can I acheive this? Is there a server-side solution? Client-side?


Edit 1 This question regards the detection of ad-blocking browser extensions:

Detecting AdBlocking software?

I'm concerned with post-detection action.


Edit 2 A duplicate question was asked after mine, so I thought I'd link to it here:

Prevent Adblock Users from Accessing Website?


回答1:


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




回答2:


It's like trying to block users from reading your contents while standing rather then while sitting. It's silly, and it's likely to drive visitors off your site. The last time i saw a "you're using adblock, that hurt web developing bla bla" i jst blocked that div with the element hiding helper. It was fun i admit. Most sites are almost unreadable as now, with flashing ads and pale contents. A good quantity of ads are, also, malevolent, disguised as part of the site they're in takes the user to bad places.

That's why you should not. If you still want to, bad news, you can't. As long as i can write $('.ad').hide() in my console, nobody can stop me from adblocking something. I sometimes give up when ads divs have a very generic class, id, or they haven't any, so that it's difficult to target them with the adblock element hiding helper (of course if they are not in the lists, in that case i dont even know they exists). So the best you can do probably is give to ads a class of .content or something you use also in other parts of the site. It's not much, but it' all you can do. And just because you can, it does not mean you should. The web marketing model have to change, and it will.




回答3:


That I know of this is not directly possible. Most add blockers work by locking at the URLs that are being "requested" and either blocking directly, or looking at the content/mime-type and blocking based on that.

You might be able to do something by looking for signs of the adblocker, but this will be difficult at best.




回答4:


Although I love my adblocker, it's about answering questions. You could check if an url that would normally be blocked by an adblocker is reachable, and continue only if that image/bla in question is loaded. otherwise, you just don't.



来源:https://stackoverflow.com/questions/2001054/block-all-content-on-a-web-page-for-people-using-an-adblock-type-browser-add-on

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!