Page 1 of 1

[SOLVED] Toolbox: Photo Gallery - Prevent Image Download

Posted: Sun Apr 05, 2026 10:20 am
by AliGW
On a desktop in a browser, the right-click option to download images is disabled by default, but this is not the case in a mobile browser (I am using Firefox for both, but testers have told me it's the same in other mobile browsers). This site is for a camera club, so we'll want the same on mobile as on desktop, but how? I am talking about the thumbnail images in the gallery, nut the ones in the lightbox.

CAVEAT: We know that you can't completely prevent image download, but we don't want to make it as easy as long pressing the image and being offered download as an option!

Thanks.

Re: Toolbox: Photo Gallery - Prevent Image Download

Posted: Sun Apr 05, 2026 10:25 am
by Pablo
The context menu is a browser feature, it is not something that is added or controlled by WWB.
But you can try to disable the context menu via JavaScript -> Ready-to-use-JavaScript->disable right click

Re: Toolbox: Photo Gallery - Prevent Image Download

Posted: Sun Apr 05, 2026 10:39 am
by AliGW
That works on a desktop, but not on a mobile phone, sadly.

Is there any code that I can add to the object?

Re: Toolbox: Photo Gallery - Prevent Image Download

Posted: Sun Apr 05, 2026 11:16 am
by AliGW
I found this, but I don't seem to be able to make the CSS snippet work: https://additionalknowledge.com/2024/08 ... ri-chrome/

Re: Toolbox: Photo Gallery - Prevent Image Download

Posted: Sun Apr 05, 2026 11:29 am
by AliGW
This seems to be what's needed, but I don't know where to put it. Does anyone know?

Code: Select all

body {
  -webkit-touch-callout: none;
}
Thanks.

Re: Toolbox: Photo Gallery - Prevent Image Download

Posted: Sun Apr 05, 2026 12:02 pm
by Pablo
You can put it in Page HTML, between head tags

Code: Select all

<style>
body {
  -webkit-touch-callout: none;
}
</style>

Re: Toolbox: Photo Gallery - Prevent Image Download

Posted: Sun Apr 05, 2026 1:22 pm
by AliGW
Perfect - thanks, Pablo! :D

Re: [SOLVED] Toolbox: Photo Gallery - Prevent Image Download

Posted: Mon Apr 06, 2026 6:27 am
by joseluz
Hi.
Advanced users know many methods to disable the download, but for me, the following script worked to disable it on both PC and mobile, Put this script in the HTML between head and head:
<script>
document.addEventListener('contextmenu', function(e) {
e.preventDefault();
});
</script>

Re: [SOLVED] Toolbox: Photo Gallery - Prevent Image Download

Posted: Mon Apr 06, 2026 6:37 am
by AliGW
Thanks for this. The issue is already resolved, but this may help someone else. :)

By the way, you need code tags, not script tags.