I have not tested this myself, but generally ad blockers try to block any elements on the page that are called "ad", its a lot more simple than you'd expect! So all you need to do is put a div on the page called like "ad" and then check to see if its been deleted or not - I found this script!
| |
| var fakeAd = document.createElement('div'); |
| fakeAd.innerHTML = ' '; |
| fakeAd.className = 'adsbox'; |
| document.body.appendChild(fakeAd); |
| |
| |
| function detectAdblock() { |
| if (fakeAd.offsetHeight === 0) { |
| |
| alert('Please disable your adblocker!'); |
| } else { |
| |
| alert('Thank you for not using an adblocker!'); |
| } |
| } |
| |
| |
| window.addEventListener('load', detectAdblock); |
You could also do it without a script; make a div this has an inner div covering it with class="ad" then if the ad is blocked you'll see whats underneath it ^^