Disabling right-clicking by using JavaScript on WiX

Here is a code I created to disable right-clicking for the images, on my end is working for desktop and mobile. Feel free to use it!

<script>document.addEventListener('DOMContentLoaded', function() {
    document.querySelectorAll('img').forEach(function(img) {
        img.addEventListener('contextmenu', function(e) {
            e.preventDefault();
        });
    });
});
</script>