Sometimes web page owners want to protect data such as Text and Images to be copied by others and sometimes it is about the link on the page that must be operate on same page by clicking mouse left button because of these reasons web page owners put a JavaScript code in their web pages to disable mouse Right click.
So if you want to perform same task then just copy paste below code inside your web page's <head> tag.
<script type="text/JavaScript">
var message="Right-click has been Disabled";
function clickIE() {
if (document.all) {(message);return false;}}
function clickNS(e) {
if(document.layers||(document.getElementById&&!document.all)) {
if (e.which==2||e.which==3) {(message);return false;}}}
if (document.layers)
{ document.captureEvents(Event.MOUSEDOWN);
document.onmousedown=clickNS;}
else{ document.onmouseup=clickNS;
document.oncontextmenu=clickIE;}
document.oncontextmenu=new Function("return false")
</script>
When somebody will come to your web page and will click on page by mouse right button then a message will pop-up "Right Click has been Disabled".
0 comments:
Post a Comment