How to disable right click, Copy and Paste function

by Ismail.EL
0 comment


How to disable right click, Copy and Paste function

Most of the bloggers and webmasters uses JavaScript technique to disable right-click, in this article i show you how to disable right-click in your web site, with this solution you can slow users down by using Javascript to disable easy right click copy and paste:

* Create an HTML file  test.html as following<!DOCTYPE html>

<body><p id=”demo”></p>
<script type=”text/javascript” src=”monscript.js”></script>
<script type=”text/javascript”>
var message=””;
function clickIE() {if (document.all) {(message);return false;}}
function clickNS(e) {if
(document.layers||(document.getElementById&&!document.all)) {
if (e.which==2||e.which==3) {(message);return false;}}}
if (document.layers)
document.oncontextmenu=new Function(“return false”)
function disSel(target){
if (typeof target.onselectstart!=”undefined”)
target.onselectstart=function(){return false}
else if (typeof!=”undefined”)”none”
target.onmousedown=function(){return false} = “default”
window.onload = function () {
document.body.onselectstart = function () { return false;}
document.body.ondragstart = function () { return false; }
Place your script here to disable!!!
an Other message her 🙂

You can use the script below so when someone right clicks to save an image off your page, a message will come up letting people know that your information is copyrighted.

* Create an HTML file test.html as following:<!DOCTYPE html>

<script language=JavaScript> 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 false; } } } if (document.layers){ document.captureEvents(Event.MOUSEDOWN); document.onmousedown=clickNS4; } else if (document.all&&!document.getElementById){ document.onmousedown=clickIE4; } document.oncontextmenu=new Function(“alert(message);return false”) </script>
<span><img src=”/media/user/my-files/project/WED-LOGO1.png” width=”300″ height=”150″ border=”0″ alt=”Protected Image.”></span>
this image is protected against right-click 🙂


In this post, i have explained How to disable right click, Copy and Paste function
If you have any questions or feedback, feel free to leave a comment.
As always, if you found this post useful, then click like and share it 🙂

21750cookie-checkHow to disable right click, Copy and Paste function

Related Posts

Leave a Comment