Click here to Skip to main content
15,559,167 members
Articles / Web Development / ASP.NET
Alternative
Tip/Trick
Posted 5 Aug 2011

Tagged as

Stats

33.8K views
5 bookmarked

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