

This script works for most (if not all) ad blockers. If one of these tests is true, it then displays the ab-message element to adblock users. Then it runs multiple checks on that iframe (if it was loaded successfully or if its style was modified). (It is randomly generated because some adblocks are smart, at some point, they realize a link is fake). A little explanation of how this script worksįirst, it appends an iframe with a source of a randomly generated link. Note the inline style added to hide it originally (Of course, you can also do this from your own CSS file).Īlso note that it takes 500ms, that's because it has to wait for the adblocker to do its thing or it won't work. Now you can use the ab-message id wherever you want to display a message to AdBlock users: Var someAd = document.getElementById('some-ad') ĭocument.getElementById('ab-message').style.display = 'block' I suppose (but cannot test) that it will give an error if the resource could not be loaded (because it was blocked). Downside is that if someone decides to block that annoying background image, it will hide your content too.Īs far as a script goes, you might be able to load the ad with an ajax request. This is not useful for an ad (not clickable), but might help you display an other message. You could however add a background-image with content. There will always be a smart CSS selector that will -just- select your element. There is no real way of going around this. However, while AdBlock might not be able to block your ad from loading, it might still be able to hide it. It would be possible to rewrite such an url on the server to point to your ad. A rule would either match no ads, or too many resources. As far as I am aware, a rule in AdBlock cannot contain a regex. AdBlock Plus 16 is an ad-blocker that is available for various. , where the image name will be random every time and without a common prefix). As recently as April 2017, a paper explored using APIs that modern web browsers. You could disguise your request in a way that it will never be 'matchable' (e.g. So what exactly could you do to be 'smarter' than AdBlock? AdBlock can hide specific elements in the DOM.Īlthough it is said that AdBlock can also modify CSS, I can't find any documentation on that other than hiding and collapsing elements.AdBlock can block resources from loading.If you want to ads to be showing, even when AdBlock is active, you'll have to understand what AdBlock is capable to do. P.S for developers: For some reason I couldn't get ABP to block these files on local environment. You can use the rules on this file to find a file name to use. For example this one which is the default one: It has bunch of lists called subscriptions which are used for blocking. in it.Īdblock plus has changed the way it finds the list and blocks the ads. One of those patterns is this (in patterns.ini): adblock is installed and enabled on this site :-DĪdblock Plus blocks certain requests or hides certain elements based on patterns it already has. You don't need to have a plugin to detect adblock, simply use this: After version 0.5, the project was abandoned until Michael McDonald improved on the original ad blocker in 2006, renaming it as Adblock Plus (ABP). It was created for Firefox in 2002 by Henrik Sorensen, a Danish developer. I have a great idea that has never been tried and ad blockers cannot block this once I get done with it.Īny suggestions and Examples will be greatly appreciated. The ad blocker currently known as Adblock Plus was originally called Adblock 0.1. Yes I know there are other methods of getting around this with NoScript addons but I already have a solution for that. The reason behind doing it this way no ad blocker can white list the JavaScript file on your server.
ADBLOCK PLUS V JS BLOCKER 2017 CODE
line of code that detects if using ad blocker What I'm looking for is a JavaScript that loads directly into the HTML that would detect if someone is using ad blocker without the use of a file. The problem with using a JavaScript file, users can white list that JavaScript file and it will no longer detect it. Most of the adblock plus detect scripts they use a file, example "show_ads.js" that is hosted on there own domain with a line it in to set it "adblock = false "

What I want to do is detect Adblock plus without using a JavaScript file or jQuery. What I'm trying to do is detect Adblock plus and display a simple message for now. After searching Google and Stackoverflow for a few hours I could not find a solution.
