Ever wondered how to disable the ability to download a self-hosted video on your divi website?

Posted by George Nicolaou

On 30 Jul, 2017
George Nicolaou - Senior Web Developer

Ever wondered how to disable the ability to download a self-hosted video on your divi website? Here's the code you need to enter in Theme Options --> Custom CSS. Kudos to the Elegant Theme Support Staff.

/*start disable video download */
video::-internal-media-controls-download-button {
display:none;
}
video::-webkit-media-controls-enclosure {
overflow:hidden;
}
video::-webkit-media-controls-panel {
width: calc(100% + 30px);
}
/*end disbale video download */

New javascript way Theme Options --> Integrations --> head

<script>
 window.onload = function() {
 videos = document.querySelectorAll('video');
 [].forEach.call(videos, function(video) {
 video.setAttribute("controlsList", "nodownload");
});
 };
</script>

10 Comments

  1. Lisa

    How would you do this for the audio module?

    Reply
    • George Nicolaou

      just replace ::video with ::audio in the code

      Reply
  2. Jo

    doesnt work in chrome

    Reply
    • George Nicolaou

      Hey Jo, that’s odd it seems fine on my end. If you feel up to it send me an exact link where you are having the issue so I can check it out.
      You can always try this new javascript code I added to the post

      Reply
  3. Heide

    Hello,
    thank you for this code. It works fine in Chrome. I added both: The CSS-Code in the Theme Customizer and the Java script in the Theme Options/Integration. I hope this is the correct way.

    Reply
    • George Nicolaou

      Yes the first block goes into Divi–>Theme Options–>Custom CSS box at the bottom and the second block of code goes into Divi–>Integration–>first box you find. Glad it helped.

      Reply
  4. Martin

    Works perfectly in chrome. Thank you George!

    Reply
    • George Nicolaou

      No worries. Whatever you need let me know

      Reply
      • Faisal

        Hello, This is my site-https://pixelactinc.com/project/royal-canton/ . I have followed the steps but still people can download the video simply right clicking on the video . Can you provide any assistance ?/

        Reply
        • George Nicolaou

          You seem to have sorted it out by yoursself using other plugins. Sorry for the delayed reply

          Reply

Submit a Comment

Your email address will not be published. Required fields are marked *

Pin It on Pinterest

Share This
Divi Theme Code SnippetsEver wondered how to disable the ability to download a self-hosted video on your divi website?