Pages

Thursday, April 28, 2011

How to block/detect Adblock by jQuery


<div class="myTestAd" style=" text-align:center;margin:10px">
 <!-- advert code goes here -->
</div>


function TestPage() {
    if ($('.myTestAd').height() == 0)
        alert("You are blocking my beautiful adverts, you swine!");
}

$(TestPage);

http://thepcspy.com/read/how_to_block_adblock/

How to use jQuery Wildcard/Start with Selector

Start with:
$("[id^=partofID]").show();

Wildcard:
$("[id*=partofID]").show();
Attribute Starts With Selector 
[name*="value"]