Disabling the Right Click on the Page prevent to view the source code using JavaScript.

Vishalneeraj-24503
Posted by Vishalneeraj-24503 under JavaScript category on | Points: 40 | Views : 1045
Below is the JavaScript code to disable right clicks on the page and prevent to viewing the source code.
on onmousedown event,we have to call below function:-
<script language = "JavaScript" type = "text/javascript">
var message = "";
function Disable_Right_Click(keyp)
{
//alert(navigator.appVersion)
if (navigator.appVersion.indexOf("MSIE") != -1 && event.button == 2)
{
alert('Right click has been disabled'); return false;
}
}
document.onmousedown = Disable_Right_Click;
</script>

Comments or Responses

Login to post response