Click here to Skip to main content
15,868,141 members
Articles / Web Development / ASP.NET
Alternative
Tip/Trick

Disable right click context menu cut, copy, paste

Rate me:
Please Sign up or sign in to vote.
4.48/5 (12 votes)
5 Aug 2011CPOL 36.3K   5   14
DescriptionD...

Description


Disable Right Click using jQuery

Code


HTML
<html>
<head>
<title>Disable Right Click using jQuery</title>
<script type="text/javascript" src="jquery-1.6.2.js"></script>
<script type="text/javascript">
$(function() {
     $(this).bind("contextmenu", function(e) {
         e.preventDefault();
     });
}); 
</script>
</head>
<body>
Disable Right Click using jQuery
</body>
</html>

Browser Compatibility


I have tested this script in the following Web browsers:

  • Internet Explorer
  • Mozilla Firefox
  • Google Chrome
  • Safari
  • Opera

jQuery


Download Latest jQuery - http://jquery.com/[^]
jQuery Tutorial - http://www.w3schools.com/jquery/default.asp[^]

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Team Leader
India India
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
GeneralMy vote of 3 Pin
sahabiswarup8-May-13 21:21
sahabiswarup8-May-13 21:21 
GeneralMy vote of 3 Pin
Michael Schauffler3-May-12 8:40
Michael Schauffler3-May-12 8:40 
AnswerRe: My vote of 3 Pin
thatraja3-May-12 19:24
professionalthatraja3-May-12 19:24 
GeneralReason for my vote of 1 Besides my comments on the original,... Pin
MadMyche25-Nov-11 9:14
professionalMadMyche25-Nov-11 9:14 
GeneralRe: Frankly thats not a fair reason to downvote. Here I just pos... Pin
thatraja25-Nov-11 16:43
professionalthatraja25-Nov-11 16:43 
GeneralIf we Disable Javascript means..Any other possible way to do... Pin
Prince Antony G24-Nov-11 19:58
Prince Antony G24-Nov-11 19:58 
GeneralSorry i early mentioned its not working... Becz i didnt Sele... Pin
Prince Antony G24-Nov-11 19:36
Prince Antony G24-Nov-11 19:36 
GeneralRe: For me its working. which FF version? Its working in FF6 or ... Pin
thatraja24-Nov-11 19:45
professionalthatraja24-Nov-11 19:45 
GeneralRe: Sorry i early mentioned its not working... Becz i didnt Sele... Pin
Michael Schauffler3-May-12 8:31
Michael Schauffler3-May-12 8:31 
GeneralIts not working in Mozilla Firefox Pin
Prince Antony G24-Nov-11 19:36
Prince Antony G24-Nov-11 19:36 
GeneralRe: Its not working in Mozilla Firefox Pin
Michael Schauffler3-May-12 8:29
Michael Schauffler3-May-12 8:29 
Generalworking fine with this script to .. must comment super duper... Pin
Denno.Secqtinstien17-Nov-11 23:53
Denno.Secqtinstien17-Nov-11 23:53 
GeneralReason for my vote of 5 thats how i would do it too :D Pin
GottZ8-Aug-11 21:04
GottZ8-Aug-11 21:04 
GeneralReason for my vote of 5 Nice tip! Pin
mbcrump5-Aug-11 10:40
mentormbcrump5-Aug-11 10:40 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.