Created
February 15, 2021 13:50
-
-
Save marifuli/b059fb75f59ea8dda2aa8420e2ad678a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Just add this JS code in you HTML however you want. it will check all kinds of AdBlocker with JS | |
*/ | |
var adBlockEnabled = false; | |
var testAd = document.createElement('div'); | |
testAd.innerHTML = ' '; | |
testAd.className = 'adsbox'; | |
document.body.appendChild(testAd); | |
window.setTimeout(function() { | |
if (testAd.offsetHeight === 0) { | |
adBlockEnabled = true; | |
} | |
testAd.remove(); | |
if (adBlockEnabled) | |
{ | |
//- if Adblocker is detected | |
document.write('<h1>Please disable you AdBlocker. We work hard to maintain the site for free</h1> <br>. Or wanna be a premium member? Contact us: [email protected]') | |
} | |
}, 100); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment