How to disable saving image by right click

How to disable saving photos in a repeating group by right-clicking?

document.addEventListener(‘contextmenu’,event=>event.preventDefault());

add script before and after with angle brackets.

The forum won’t let me type the code for some reason.

Screen Shot 2025-07-13 at 10.10.27 AM

type or paste code here
1 Like

can I write you a private message so that you can help me write the code?

Thanks @boston85719

You can drag an html element onto your page and input the code below.

You’ll need to add this to every page you want to protect, but you can just hide the element on the page.

If you want to do the whole site, you can put the code in a reusable element like a header or footer that you use site-wide.

There are plugins, but this is a free way to do it. I prefer not using plugins because of a lot of reasons…but everyone has their own way of doing things.

Also, remember, even with a plugin or the method below, you cannot fully keep someone that is set on getting that image from your site. They can screenshot or use browser tools. But, the method stops most.

<script>
document.addEventListener('contextmenu', event => event.preventDefault());
</script>

thank you very much! this really helped!

1 Like

or maybe you also know how to make it so that when you right-click on an element in a repeating group, it opens in a new tab

This topic was automatically closed after 70 days. New replies are no longer allowed.