Saturday, Jan 21, 2017
Do you want to create your own website but don't know how to do it. Let's take this course from TreeHouse which is one of the best online course website for developers where you can learn everything from the beginning to the end to create your own website and become the master in creating Websites. Click Here To Get 7 Day Free Trial →
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.
Hello, My Name is Mudit Jain. I am a Web Developer, Professional Blogger and Digital Marketer from India. I am the founder of TalkersCode. I started this blog in february 2015 to help web developers & bloggers by providing easy and best tutorials, articles and offers for web developers and bloggers.