3 ms·
Here's a simple detect function if you want to show adblock users a big paywall, which could be good if you have enough of them. function detect(cb) { va
by axod 17y ago
Here's a simple detect function if you want to show adblock users a big paywall, which could be good if you have enough of them.
function detect(cb) {
var tt = document.createElement("div");
tt.style.display = "none";
document.body.appendChild(tt);
var i = document.createElement("iframe");
i.src = "http://adv.foo.com/ads/-adspace?ad_id=&affiliate=&advert=678";
var foo = i.style.cssText;
tt.appendChild(i);
window.setTimeout(function() {
cb(foo!=i.style.cssText);
}, 200);
}
the callback 'cb' will be called with true if adblock is installed.
- doron 17y agoTo Quote Wladimir Palant, developer of Adblock Plus "There is only one reliable way to make sure your ads aren't blocked - make sure the users don't want to block them. Don't forget about the users, use ads in a way that doesn't degrade their experience."
- jimmyjim 17y agoSounds like a very small phase in a cat-and-mouse chase. The people who use AdBlock are pretty technically savvy, they'll jump on another plug-in that bypasses the hack you've just mentioned in no time. And the hack doesn't work anyway for some existing popular adblock extensions. Perhaps it would be more worthwhile to move to a different model altogether.
- radu_floricica 17y agoMany technical minded people tend to think that if something will eventually fail, it's not worth doing. There's an old joke about a horse trainer who was ordered by his king, under penalty of death, to teach his horse to speak. So he very methodically starts to do just that. When asked why he's trying to do the impossible, he answers: "Teaching takes a long time. Maybe the king dies. Maybe the horse dies. Or maybe the horse learns to talk."
- jrockway 17y agoMaybe Adblock is updated the next day, and you basically wasted your afternoon. Time you will never get back, all for nothing.
- axod 17y agoafaik, modifying css or not loading the advert is the most common adblock approach. To do anything lower level would be far harder. One of the whole points of adblock is also to reduce bandwidth usage on the client side, increase load speed etc. So if you're using adblock and not loading ads from the server, that behavior is obvious and easily detected. Advertising works extremely well. A very small minority of users decide to block all advertising without even giving websites the chance to show value in it. I disagree about adBlock being tech savvy. Most of the time it's just doing regexps on iframe/image sources. Which is ridiculously naive. Is this an ad? <a href=/foo.html>beds</a>. Definitely could be, yes. Can adblock block it? Nope. If adblock did become more widespread (I doubt it will), then the advertising would just move server side, and become more hidden so that it can't be detected. You'll stop seeing <iframe src="http://adserver.foo.com/?id=7382> http://adserver.foo.com/?id=7382> and you'll start seeing <iframe src="http://www.foo.com/content/7382.html> http://www.foo.com/content/7382.html> What's this alternate model you've devised for the web? Say we removed all advertising from the web, how much money would we each have to pay a day to replace that revenue? How many of us would be willing to pay to use the web like that? I know I wouldn't.
- jrockway 17y agoYou'll stop seeing <iframe src="http://adserver.foo.com/?id=7382> http://adserver.foo.com/?id=7382>; and you'll start seeing <iframe src="http://www.foo.com/content/7382.html> http://www.foo.com/content/7382.html>; Some sites do this. In that case, you can guess that something is an ad based on the size of the image -- advertisers like to buy ads in standard-sized chunks, and you can just block all images that are that size. Adblock also uses filters available from the Internet that automatically update at a certain interval. So if foo.com is even moderately popular, the filterset will be updated to block your site's ads reasonably quickly. Finally, NoScript solves the problem of your adblock detector. If I don't run your detection code, the callback will not be called.
- axod 17y ago>> "Finally, NoScript solves the problem of your adblock detector. If I don't run your detection code, the callback will not be called." So just deny access if the callback isn't called with false :/ eg only render the content if the callback is called with false. The number of people browsing with js disabled is pretty moot these days.
- jrockway 17y agoSure, do that. There are plenty of other sites on the Internet that don't do that, and I will just use those instead.
- cryptnoob 17y agoThat's quite a threat. If you make me actually pay for what I consume in your store, I'll take my business elsewhere! You better watch it. I'm not kidding about this. You just lost a non-paying customer, you SOB!
- jrockway 17y agoMost sites don't get their views from people typing the URL into the URL bar. Maybe it's the "non-paying customer" that posts your site to HN and Reddit every day. By banning that one user who doesn't like ads, you lose the opportunity to serve thousands of ads. Also, if you don't like people stealing your content, you'd better block Google. They display their own ads next to your content! Finally, ads are not just on content sites. Amazon.com has ads, which I block. I spent like $3000 at Amazon last year. If they block me because I'm not viewing their ads, that's $3000 in tangible revenue down the toilet, all so they could make 30 cents on some ad views. Needless to say, I doubt Amazon will be banning me for not viewing ads any time soon.
- axod 17y agoYou're coming out with some crazy strawman arguments. obviously amazon wouldn't block you. They don't make all their money from advertising. They're primarily a retailer :/
- axod 17y agoGreat. That is the behavior I would encourage. If you don't like a websites ads, don't use that website. Everyone wins.