Last Updated : Jul 1, 2023
Then he may not view any ad in any website and this in return loss of ad revenue for website owner who put ads on their website to generate income.
To Detect AdBlocker It Takes Only Two Steps:-
- Make a HTML file and define markup and scripting
- Make a js file and define scripting for adblocker
Step 1. Make a HTML file and define markup and scripting
We make a HTML file and save it with a name detect_adblocker.html
In this step we create a variable called adblock and set it to true and add 'adframe.js' file. Adblocker working is very simple it detects any external file having 'ad' or ad related phrase in file name then it block `that file or url from running in that webpage.
So in our case if adblocker is enabled then it blocks our 'adframe.js' file and remain our adblock variable to true and if the adblock is disabled then our 'adframe.js' file will run and our adblock will become false.
After then we check if our adblock variable value is true then display error message and hide the webpage content.You may also like Detect URL In Input Using jQuery.
Step 2. Make a js file and define scripting for adblocker
We make a js file and save it with a name adframe.js
var adblock = false;
In this step we simply set adblock variable value to false if this file run then the value of adblock become false it means adblock is not installed or disabled. You may also like Detect And Redirect To Mobile Site Using PHP.