XF 2.2 How to use protect: true for lightbox images?

MacSeah

Active member
Hi guys, I'd appreciate any help given. I've been scratching my head over trying to get protect: true to work for my lightbox attachments to prevent users from right-clicking and saving attachments.

I have very basic JS knowledge, I've searched the entire jquery.fancybox.js file and changed the only instance. Still no luck on achieving this though. Does anyone know how I can get this done?

Thanks in advance again!
 

MacSeah

Active member
We understand that but the key is not to ensure most people who doesn't even know what a browser console is to not able to do that.


Do you think you can point me to a direction?
 

tomnjerry74

New member
Have you considered doing something like this to just disable image interaction site-wide? Found the code online but maybe it could be adapted.
JavaScript:
var client = {
     init: function() {
          var o=this;

          // this will disable dragging of all images
          $("img").mousedown(function(e){
               e.preventDefault()
          });

          // this will disable right-click on all images
          $("body").on("contextmenu",function(e){
               return false;
          });
    }
};

I definitely agree with Brogan though, even if you block people from things like right clicking and dragging, you’ll never stop screenshots which 99% of people know how to take on mobile.
 

RobinHood

Well-known member
Screenshots take two seconds on mobile, the snip tool is built into Windows and will easily snip an image too. Not being able to easily save and share images just becomes frustrating to users. If you're worried about the image being stolen you should enable watermarking instead. At least that way if they do get saved or shared elsewhere your site name will still be on it, potentially driving traffic back your way.
 
Top