[dvLden's Share] echoAds - Detect Adblock Browser Extension
2014-01-22, 11:12 PM, (This post was last modified: 2014-07-21, 09:16 PM by dvLden.)
#1
Here I come with another share of my custom scripts!
Today I will share my latest Adblock Detector that you may use on any kind of website or CMS.


[Image: zTnIhKZ.png]


What is echoAds ?
Well you remember that some CPA networks has that thing within their Gateway script called (no-js and no-adblock)... Well except that their thing redirects visitor off of your website. Which is very bad...

I have created this little plugin with a jQuery. It will detect if visitor has Adblock extension enabled and show them warning with your message or even redirect them to wherever you want. You may trigger custom functions and so on...


[hide]
Preview of echoAds Plugin Code
Code:
/*
*  Project: echoAds
*  Description: Detect Adblock Browser Extension
*  Author: dvL-den
*  License: Copyrights dvL-den. All rights reserved.
*/

(function ($) {
  $.echoAds = function () {

    var options = $.extend({
      domain: window.location.origin,
      detected: function () {},
      undetected: function () {}
    }, arguments[0] || {});

    $.get(options.domain + '/js/advertisement.js');

    setTimeout(function () {
      if ($.adblockDetector === undefined) {
        options.detected.call(this);
      } else {
        options.undetected.call(this);
      }
    }, 300);
  };
})(jQuery);


Plugin Trigger and Explanations
Code:
$.echoAds({
  detected: function() {
    // In here you can write whatever you want to do, if Adblock is detected on visitors side.
    // Right now it will just fetch the html document with content and reveal it on your website.
    $.get('ajax/echoAds.html', function (adblock) {
      $('body').append(adblock);
    });
    $('html').css('overflow', 'hidden');

    // However, if you'd like to redirect your visitors to another page/link,  you could do something like this... Keep in mind that "//" in JS is a comment.
    // window.location.href = 'http://cpaelites.com/';
  },
  undetected: function() {
    // This is what happens if Adblock is not detected. Right now it only removes class that I have set in html tag and reveals the website content.
    $('html').removeClass('adblock');
  }
});


Requirements to Make it Work
• jQuery library
• The plugin itself with advertisement.js within JS folder.
• class="adblock" attached to your <html> tag.
• Inside of a CSS, adding class or ID of the content wrapper... Int his sample it's #demo so I have added that... html.adblock #demo
• If you are on subdomain, you will be expecting issues. You need to write domain: 'http://yourwebsite.com/another_folder/' inside of a plugin trigger.


Demo
dvL-den Redirect


Download

.zip   echoAds.zip (Size: 33.38 KB / Downloads: 50)
[/hide]
Reply
Share This Thread :

2014-01-22, 11:18 PM,
#2
Another awesome share by one of our HQ member here. Thanks for this mate. Keep it coming.
Reply
2014-01-22, 11:24 PM,
#3
thanks for the awesome share mate :)
Reply
2014-01-22, 11:29 PM,
#4
Awesome share! Thanks!

[Image: omaztar.png]
Failure should be our teacher, not our undertaker.
Failure is delay, not defeat. It is a temporary detour, not a dead end.
Failure is something we can avoid only by saying nothing, doing nothing, and being nothing.

Reply
2014-01-22, 11:44 PM,
#5
Great share as always! Thanks a lot!
Reply
2014-01-22, 11:57 PM,
#6
Ya 'll welcome fellows ! ;)
Reply
2014-01-23, 12:04 AM,
#7
nice share... thanks a lot!
Reply
2014-01-23, 12:07 AM,
#8
This is an example of one of those things that I don't specifically think to change, but it DOES matter.

Thank you very much, sir. :p

[SHARE] CPA Elites Forum Citer Script! Look Inside! [Forum Tool]
[SHARE] CPA Elites Link To Post PM Script! Look Inside! [Forum Tool]
[Image: D8HZ2ho.png]
"I have not failed 1,000 times. I have successfully discovered 1,000 ways to NOT make a light bulb." -Thomas Edison
Reply
2014-01-23, 12:25 AM,
#9
(2014-01-23, 12:04 AM)Blog2Show Wrote: nice share... thanks a lot!

Glad you like it. Enjoy and you're welcome!

(2014-01-23, 12:07 AM)OMGWTFISTHIS Wrote: This is an example of one of those things that I don't specifically think to change, but it DOES matter.

Thank you very much, sir. :p

Ehehehe :P
No problems mate... I hope I'm not too old since you call me sir. (I'm 21)
Enjoy and thank you too ;)
Reply
2014-02-02, 10:02 PM,
#10
Nice share :) I really need to get some more posts :)
Reply


Related Threads
Thread Author Replies Views Last Post
  [TEMPLATE] Online Generator With Force Like and Share Script and Connect to FB Twisted Fate 70 10,866 2018-05-25, 07:34 PM
Last Post: emirasor
  ☆ SHARE | The Best Fake Resources Proof Footage Pack! | High Quality ☆ Mr. Tokyo 30 4,160 2018-05-17, 04:24 AM
Last Post: Mr. Tokyo
  [Mega Share] Download 1000s of WSO's For Free Superhero99 25 4,430 2018-05-10, 08:20 AM
Last Post: dwivediaman
  [GET] HTML Share FB to Unlock phobia 69 16,771 2018-05-04, 06:44 PM
Last Post: smith21
  [OGAds Share] ANIMATED CONTENT LOCKERS! XDShiftBlue 16 1,537 2018-04-25, 06:36 PM
Last Post: mattsub





About Us | Contact Us | CPA Elites | Advertise | Stats

© 2013-2018 CPA Elites Ltd
Enhanced by MyBB and WallBB
Return to top