-->

Disabling Right-Click On Your Website

Have you noticed some websites with the right-click disabled? Well. Thats really a great thing to do when you dont want the people to be able to see few of your HTML codes. For ex: Inspect Element in Google Chrome.
This fuction adds on a step to your privacy. Anyhow, this can't be said as the highest level of security and there is no bypass to it. But, as I said earlier, it just adds on a step. You can see this website as an example.

Here is the code which will help you out with the process described above.


<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>

Copy the above code and paste it in Dashboard > Layout > Add Gadget > HTML / JavaScript. 
Thats it! You are done. 
And yeah. Don't forget to drop down the comments!

No comments:

Post a Comment

Leave your valuable feedback...