00 Votes

jQuery: Prevent Right-Click on Website

Tip by Sledge | 2012-07-22 at 22:41

Sometimes we want to prevent the user from right clicking on our website. With this small piece of code and the help of jQuery, you can simply avoid that the context menu opens when the user right clicks on the page:

$(document).ready(function() {  
   $(document).bind("contextmenu", function() {  
      return false;  
   });  
});  

Of course, also this code cannot prevent effectively, that someone can save the images or something else from our website. First of all, it only works with activated JavaScript and secondly, there are other possibilities to save images then to use a right click. But users who are unaware of what they are doing, can be certainly deterred.

ReplyPositiveNegative

About the Author

AvatarThe author has not added a profile short description yet.
Show Profile

 

Related Topics

VirtualBox: Change Date and Time

Tutorial | 10 Comments

Important Note

Please note: The contributions published on askingbox.com are contributions of users and should not substitute professional advice. They are not verified by independents and do not necessarily reflect the opinion of askingbox.com. Learn more.

Participate

Ask your own question or write your own article on askingbox.com. That’s how it’s done.