-
-
Save dterracino/43a14c9cdb119d4efdf15f00c20dd01e to your computer and use it in GitHub Desktop.
Detects ads blockers
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
| 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(); | |
| console.log('AdBlock Enabled? ', adBlockEnabled) | |
| }, 100); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment