Click here to Skip to main content
12,702,455 members (34,575 online)
Click here to Skip to main content
Add your own
alternative version

Tagged as



Disable right click context menu cut, copy, paste

, 25 Nov 2011 CPOL
Rate this:
Please Sign up or sign in to vote.
var message="Function Disabled!";function clickIE4(){if (event.button==2){alert(message);return false;}}function clickNS4(e){if (document.layers||document.getElementById&&!document.all){if (e.which==2||e.which==3){alert(message);return...
<script type="text/javascript">
var message="Function Disabled!";
function clickIE4(){
if (event.button==2){
return false;
function clickNS4(e){
if (document.layers||document.getElementById&&!document.all){
if (e.which==2||e.which==3){
return false;
if (document.layers){
else if (document.all&&!document.getElementById){
document.oncontextmenu=new Function("alert(message);return false")

This Will Work.I have tested In: Internet Explorer, Mozilla Firefox, Google Chrome.

No matter what you do, you can't prevent users from having full access to every bit of data on your website. Any Javascript you code can be rendered moot by simply turning off Javascript on the browser (or using a plugin like NoScript).


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


About the Author

No Biography provided

You may also be interested in...


Comments and Discussions

Questionnot working in google chrome Pin
ndsolanki.it20-Nov-12 1:06
memberndsolanki.it20-Nov-12 1:06 
GeneralReason for my vote of 1 See my comments for the original ver... Pin
LFD-Mike25-Nov-11 10:15
memberLFD-Mike25-Nov-11 10:15 
GeneralThis Code also Work...But When Disable Javascript it wont wo... Pin
Prince Antony G24-Nov-11 20:55
memberPrince Antony G24-Nov-11 20:55 

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.

| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.170118.1 | Last Updated 25 Nov 2011
Article Copyright 2011 by Prince Antony G
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid