Ad blocking or ad filtering is a software capability for removing or altering online advertising in a web browser or an application. An ad blocker is a program that will remove different kinds of advertising from a Web user’s experience online.
In this article, we are going to detect if an AdBlocker is enabled while an user is surfing your webpage.
These simple 2 steps will allow us to detect whether AdBlocker is enabled/disabled in the web browser :
Declare a variable adblock in the adframe.js file and save it as :
var adblock = false;
- The basic idea is : if adframe.js file is not loaded by the browser, it means AdBlocker is enabled
By default we will set adblock = true;
Instead of alert message, we can provide proper message in a popup or whatever looks appealing. We can request users to disable AdBlocker for better experience of our site.
Follow this video for implementation of the above technique :