How to disabled right Click and copy using JavaScript - Web Development and Web Design Codes

Latest

Saturday, February 17, 2018

How to disabled right Click and copy using JavaScript

How to disabled right Click and copy using JavaScript

How to disabled right Click and copy using JavaScript
How to disabled right Click and copy using JavaScript

Hi Friends Today we are going to learn how to disabled or prevent right click using JavaScript..you can use this code to protect your website content from the theft..
use the below codes to implement JavaScript right click disabled..

Just put the below JavaScript code in your head tag..
function disableselect(e){  
return false  
}  
function reEnable(){  
return true  
}  
//if IE4+  
document.onselectstart=new Function ("return false")  
document.oncontextmenu=new Function ("return false")  
//if NS6  
if (window.sidebar){  
document.onmousedown=disableselect  
document.onclick=reEnable  
}

Full codes 
<html>
<head>
<title></title>
<script type="text/javascript"> 
function disableselect(e){  
return false  
}  
function reEnable(){  
return true  
}  
//if IE4+  
document.onselectstart=new Function ("return false")  
document.oncontextmenu=new Function ("return false")  
//if NS6  
if (window.sidebar){  
document.onmousedown=disableselect  
document.onclick=reEnable  
}

</html>
</script>
</head>
<body>
<h1>Welcome to CodeNair</h1>
<p>Welcome to CodeNair</p>
</body>

That's it Friends How to disabled right Click and copy using JavaScript..Keep visiting for more codes..Thank You...

No comments:

Post a Comment

Thank You for Your Comment

Note: Only a member of this blog may post a comment.