AdBlock Detection with JavaScript / jQuery Update

HTML

<div class="adsense">
<!-- AdSense code goes here! -->
</div>

jQuery

$(document).ready(function(){
setTimeout("checkAds();", 1000);
});
function checkAds() {
if ($(".adsense").height() == "0") {
$(".adsense").after("<div class='alt'><h3>Don't like ads?</h3><p>Me neither.</p><p>But you should know that the ads on this site help pay for hosting, domain renewal, and keeping me motivated to make other oddball apps and websites.</p><p>Please consider disabling your adblock software for this domain. In return, I'll give you an appreciative high-five if we ever meet in real life.</p><p>-Tommy</p></div>");
}
}

How It Works / Demo

Pretty straightforward, really. This waits a second after the doc loads and sees if the .adsense block has any height. If not, it puts a message after it.

The old code used math and tried to count the number of children, but it was sort of clunky even when it did work.

Like before, don’t expect this method to be foolproof. I’m open to other ways.

To see it in action, visit my BigImg.it app with and without AdBlock enabled.