jQuery AdBlock Dectector : How to detect AdBlock

If you are a website owner, you may be relying on some form of advertising to get some income for your hosting fee or domain registration. However, there is an addon called “AdBlock” which can block all the ads on your website.

By using jQuery, you can detect whether the user has AdBlock enabled or not. You may then give a warning to the user to disable adblock to browse your website. First include jQuery in thesection of the file. Then include another file with the name “advertisement.js”. Then use the following code to detect whether AdBlock is active or not. You can edit the code for your requirement, like forwarding the user to some other page if AdBlock is enabled.

[gist id=”3883935″]

Complete HTML is here. Make sure you include

$.ads = true;

in advertisement.js file.

[gist id=”3883986″]

Leave a Reply

Your email address will not be published.