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>