0

I have a lot of video clips on my site available for download. Below code achieves that. Now I know how to detect if a user has AdBlock installed, these links helped me: 1 help1

2 help2

3 help3

With most these solutions a "general" custom message gets shown if AdBlock is detected but there are no more "tougher" actions implemented, so is it also possible that when a user clicks "download" that the "download" output is a message like "You need to enable advertisements to display in order to download video clips" instead of that the user can actually download the file???

HTML DOWNLOAD :

<div class="box download-box">
     <a class="button" href="">
          <i class="fa fa-download"></i> Download
     </a>
</div>

HTACCESS :

<FilesMatch "\.(mov|avi|mp4)$" >
   ForceType application/octet-stream
   Header add Content-Disposition "attachment"
</FilesMatch>
Community
  • 1
  • 1

1 Answers1

0

Short answer:

Yes you can.

Long Answer:

For my case I usually send information to the server on page load contain if there is an ad blocker enabled on the client side and therefore I prevent the media from being sent to the browser.

How to detect:

I made a small script that can detect that you can find more info on Github detect-adblocker.

using it is very simple. you only need to add the script at the top of your head tag like:

<head>
<!--adBlocker detection code - START-->
    <script src="//adblocker.fortiapp.com/ads.js"></script>
    <script>
        (function (i, o, g, r) {
            i[o] = (typeof i[o] == typeof undefined) ? g : r
        })(window, 'adblocker', true, false);
    </script>
    <!--adBlocker detection code - END-->

    // some other scripts if any
</head>

then later in your main app do:

if(adblocker){
    // send information to the server that ad blocker is active and
    // therefore prevent whatever you want from being sent to the user
}
Mustafa Dwaikat
  • 3,392
  • 9
  • 27
  • 41