Ad Block Plus makes changes to the DOM when Flash is detected so alls we have to do is look for these changes. This method does require that Javascript is enabled for the site.
Add a embed tag to your site and have it load a blank Flash file. I used:
<embed type="application/x-shockwave-flash" src="blank.swf" bgcolor="#ffffff" quality="high" height="20" width="80">
You could create your own flash file but I found a blank one here that I downloaded to my server:
http://community.shozam.com/forums/storage/1/1912/blank.swfThis code is taking advantage of mootools so you can get it from mootools.net
Next is the Javascript:
<script src="js/mt.js" type="text/javascript"></script>
<script type="text/javascript">
window.addEvent('domready', function() {
// every 3 seconds
var timer = 3;
var periodical;
var checkad = (function() {
var links = $$('a');
if($chk(links)) {
links.each(function(item, index){
if( item.get('title') == 'Click here to block this object with Adblock Plus' ||
item.get('title') == 'Block this object with Adblock Plus' ){
alert('Ad-Block detected');
}
$clear(periodical);
});
}
});
periodical = checkad.periodical(timer * 1000, this);
});
</script>Note: This was tested with Ad Block Plus 1.0,
it works for en-GB and en-US
No comments:
Post a Comment