JavaScript

How to prevent all embedded videos from downloading

This is a method to prevent all embedded videos on the management site from being downloaded.


const video = document.querySelectorAll('video');
for (let i = 0; i < video.length; i++) {
    video.item(i).setAttribute('controlsList', 'nodownload');
    video.item(i).setAttribute('oncontextmenu', 'return false;');
}

Using the Javascript code above will control the controlslist and the download will disappear.
Then right click on the video will not work.
If you are a light user, you will not be able to download videos with this.

However, if you can see the source code, you can download it, so it is only a limited support.