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!)





setTimeout(“checkAds();”, 1000);

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

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.



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 app with and without AdBlock enabled.

  • Pingback: High Quality Bookmarks » AdBlock Detection with JavaScript()

  • Thank you. The script is very useful for me. I’ve implemented this script on one of my web and running well.

  • Vindexus

    Thanks this worked perfectly. Also it’s “foolproof” not “fullproof”.

  • Fixed, thanks. That was fullish of me.

  • Vindexus

    Oh you!

  • tommytanktop

    hi, this looks good. where would i insert the code?

  • Pingback: jQuery: AdBlock Warning | fuchskit()

  • Works like a treat! This is a very useful script, Thank you :)

  • gzizzle

    I can’t seem to get this to work, the height attribute is 94 regardless whether adblock is on or not.