P
P
prrrrrrr2018-12-13 18:36:05
JavaScript
prrrrrrr, 2018-12-13 18:36:05

How to block the site when adblock / ublock is enabled and so on?

Tell me how to prevent users from visiting the site when adblock / ublock and other ad blockers are enabled? Tried to google, but only highlights how to get around. If possible, for example

Answer the question

In order to leave comments, you need to log in

9 answer(s)
C
crdrads, 2018-12-14
@prrrrrrr

Try this, but it's easier to check it yourself - https://github.com/sitexw/FuckAdBlock

D
d-stream, 2018-12-13
@d-stream

Most adblocker users simply immediately leave the begging sites if their begging in any way interferes. Of course, there are rare exception sites on which blockers are disabled.
But in order to achieve this, you need to be a resource like Habr or Microsoft.

U
uRoot, 2018-12-13
@uroot

In order to bypass such definitions for the presence of adblock / ublock, simply disable JS. But here the matter is different. If I personally see such a site, then I simply will never return to it again, or I will block the "Turn off adblock" pop-up window with the same adblock.
And so many will do - they simply will not return to your site.

4
4tlen, 2018-12-13
@4tlen

See what classes blockers block and assign the same content blocks. Rub along with advertising.

A
Alexey Arkh, 2018-12-13
@AlekseyArh

You need to create, for example, a div with a class whose name is associated with advertising. "advertising", for example, then check with a js script whether this block exists, if it was deleted or hidden, then apply a layout layer to the site that there is no access.

S
Sergey Sokolov, 2018-12-13
@sergiks

BusinessInsider uses piano.io for advertising. For those, the definition of the presence of an adblocker consists in requesting a script that adblocks consider advertising and do not download. The handler onerroris executed in the presence of an adblocker.

document.cookie = "__adblocker=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/";
    var setNptTechAdblockerCookie = function(adblocker) {
        var d = new Date();
        d.setTime(d.getTime() + 60 * 60 * 24 * 2 * 1000);
        document.cookie = "__adblocker=" + (adblocker ? "true" : "false") + "; expires=" + d.toUTCString() + "; path=/";
    };
    var script = document.createElement("script");
    script.setAttribute("async", true);
    script.setAttribute("src", "//www.npttech.com/advertising.js");
    script.setAttribute("onerror", "setNptTechAdblockerCookie(true);");
    document.getElementsByTagName("head")[0].appendChild(script);

But in general, this is a constant race: advertisers and blockers.

A
Alexey Guest007, 2018-12-20
@Guest007

Yes. Colleague's advice Aleksey Arkh Aleksey Arkh is quite working. In one project, they did just that - adv.js, loading, set a variable. further actions depended on its value. But we did not block, but warned that with the adblock enabled, we would not consider claims for non-accrual cashback. This is fine. Because if the adblock cut off something by which the partners identify the buyer to assign this cashback, then we will not be able to help. Money is the only working stimulus.
And I’ll speak for myself - if the site makes the display of content dependent on my security (and the adblock is primarily my privacy and data security, plus it keeps my brain from tons of advertising garbage), then I won’t go there again. All point. Exceptions are very rare. Better think about other ways to monetize your brilliant thoughts (or are they not so brilliant? :-) )
By the way, in the issuance of Google often comes across a site with, as I understand it, translations of stackoverflow materials. At one time they mirrored the text when the filter was on. Well, not really necessary - reading English is not a problem. However, recently I noticed that they no longer turn over. Apparently I'm not the only one ignoring sites that require me to be naked in public :-)

D
dkrasnikov, 2021-09-03
@dkrasnikov

I found, it seems, a ready-made solution - https://www.getadmiral.com/ An alert from them got out on some site

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question