Skip to content

Detecting AdBlock with jQuery or JavaScript

Recently a large number of users use browser extensions that block advertising, the most known is AdBlock Plus. If our website is financed thanks to the publicity this can be a problem. In this case we can use JavaScript to detect if AdBlock or another similar plugin is blocking our advertising.

A cunning may be placing the script of advertising within a div and check if your height is greater to 0.

Html:

 

JQuery:

Js:

 

Another cunning can be check for iframes since ads like AdSense use them.

jQuery:

Js:

 

Share on Facebook1Tweet about this on TwitterShare on Google+0Share on Reddit0Email this to someone

I 'm a programmer , systems analyst and designer of websites , apps and software since 2006. Study in Marseille and currently living in Rio de Janeiro and work as Symfony developer.