PHP

Disable context menu right click, cut, copy and paste

If You are looking for a simple way to disable right click for any html element then here you will find the best solution to disable right click on page.

Just add the following code to the HEAD tag of your web page:

<script src=https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.3/jquery.min.js></script>

Script to Disable Cut Copy & Paste

Using this script, you can prevent user to cut (CTRL+X), copy (CTRL+C) and paste (CTRL+V)content from your web pages.

<script>
$(document).bind(“contextmenu”,function(e){
return false;
});
</script>

 

Script to Disable Mouse Right Click

<script type=”text/JavaScript”>
//courtesy of disable copy
function killCopy(e){
return false
}
function reEnable(){
return true
}
document.onselectstart=new Function (“return false”)
if (window.sidebar){
document.onmousedown=killCopy
document.onclick=reEnable
}
</script>

Advertisement

Did you find this helpful? Share it!

Leave a Comment

Your email address will not be published. Required fields are marked