Disabling right click on images using jquery

前端 未结 9 2144

I want to know how to disable right click on images using jQuery.

I know only this:



        
相关标签:
9条回答
  • 2020-11-30 20:49

    Would it be possible to leave the ability to right click and download just when done a separate watermark is placed on the image. Of course this won't prevent screen shots but thought it may be a good middle ground.

    0 讨论(0)
  • 2020-11-30 20:50

    A very simple way is to add the image as a background to a DIV then load an empty transparent gif set to the same size as the DIV in the foreground. that keeps the less determined out. They cant get the background without viewing the code and copying the URL and right clicking just downloads the transparent gif.

    0 讨论(0)
  • In chrome and firefox the methods above didn't work unless I used 'live' instead of 'bind'.

    This worked for me:

    $('img').live('contextmenu', function(e){
        return false;
    });
    
    0 讨论(0)
提交回复
热议问题