Advertisement
w0lfiesmith

Adblock detector and message

Apr 15th, 2012
867
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <!-- SHOW MESSAGE TO USERS WITH JS DISABLED or ADBLOCK ON -->
  2. <noscript>
  3.     <div class="noscriptmsg" style="width:100%;background-color:red;color:white;font-size:20px;padding:20px 0;">
  4.     <p style="width:960px;margin: 0 auto;">Please enable Javascript to use MakeUseOf to it's fullest. Without it, you will find much of the modern internet doesn't work. I would add a little button hide this message, but that kind of functionality requires Javascript ;)
  5.     </div>
  6. </noscript>
  7. <div id="adblockmsg" style="width:100%;background-color:red;color:white;font-size:20px;padding:20px 0;display:none;">
  8.     <p style="width:960px;margin: 0 auto;">It looks like you've got Ad-block enabled. While we respect your decision and choice of plugin, we humbly ask that you add MakeUseOf.com to the ad-block whitelist. Without the revenue generated from advertising, we would be unable to provide this great content free of charge. If everyone ran ad-block, MakeUseOf would be no more.
  9. </div>
  10.  
  11. <script type="text/javascript">
  12. function blockAdblockUser() {
  13.     if ($('.img-banner').height() == 0) {
  14.         //window.location = 'http://example.com/AdblockNotice.html';
  15.         $('#adblockmsg').show();
  16.     }
  17. }
  18.  
  19. $(document).ready(function(){
  20.     blockAdblockUser();
  21. });</script>   
  22.  
  23. <!-- END ADBLOCK NOSCRIPT CHECK -->
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement