Created
February 24, 2017 15:45
-
-
Save atmoner/a276ef1d68cc4287f8589b2d4d9d8e40 to your computer and use it in GitHub Desktop.
Adblock-detector: https://github.com/atmoner/Adblock-detector
This file contains 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