Created
August 27, 2017 23:27
-
-
Save sayhicoelho/9f3acc3d4ea57e64a1825faa36270da1 to your computer and use it in GitHub Desktop.
Script para detectar se há AdBlock sendo utilizado pelo seu visitante
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
window.onload = function () { | |
var ads = document.querySelectorAll('.adsbygoogle'); | |
var isReal = true; | |
for (var i = 0; i < ads.length; i++) { | |
if (ads[i].innerHTML.length === 0) isReal = false; break; | |
} | |
if (!isReal) { | |
document.body.innerHTML = '<div style="text-align: center"><img style="height: 200px;" src="https://i.ytimg.com/vi/kaqSZNE2adM/maxresdefault.jpg" alt="Stop blocking Ads!"/><br/>Oops! Notamos que você está com AdBlock habilitado.<br/>Para acessar nosso site é preciso desabilita-lo.</div>'; | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment