AdBlock Detection with JavaScript / jQuery Update

(Yo! This is an update to my Show a Message to AdBlock Users with jQuery / JavaScript post, which I don’t think works anymore!)

HTML

[html]

[/html]

jQuery

[js]$(document).ready(function(){
setTimeout(“checkAds();”, 1000);
});

function checkAds() {
if ($(“.adsense”).height() == “0”) {
$(“.adsense”).after(“

Don’t like ads?

Me neither.

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.

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.

-Tommy

“);
}
}[/js]

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.

10 Responses to AdBlock Detection with JavaScript / jQuery Update

  1. Pingback: High Quality Bookmarks » AdBlock Detection with JavaScript

  2. Pingback: jQuery: AdBlock Warning | fuchskit

  3. Pingback: Bypass AdBlock and show a note - Toxigon