|
Restrict right click
|
|
07-22-2007, 11:10 PM
Post: #1
|
|||
|
|||
|
Restrict right click
Hi guys
i want to restrict right clicking in my web page can anyone help me out with a Javascript for this........ |
|||
|
07-23-2007, 11:58 AM
Post: #2
|
|||
|
|||
|
RE: Restrict right click
Hi Kannan
You can restrict right click on your web page or protect your source code by using this script. Customize your message"Function Disabled"....But disabling right click is not a complete solution to save the data.. Use following Java scripts. <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> |
|||
|
07-23-2007, 09:43 PM
Post: #3
|
|||
|
|||
|
RE: Restrict right click
Just add the following line to the body tag.
PHP Code: oncontextmenu="return false;" Eg: PHP Code: <body oncontextmenu="return false;"> This would disable the right click. |
|||
|
06-10-2013, 03:35 PM
(This post was last modified: 06-14-2013 08:47 AM by albinjoseph.)
Post: #4
|
|||
|
|||
|
RE: Restrict right click
You can use the following code to disable right click on a web page:
<script language=JavaScript> var message = "function disabled"; function rtclickcheck(keyp){ if (navigator.appName == "Netscape" && keyp.which == 3){ alert(message); return false; } if (navigator.appVersion.indexOf("MSIE") != -1 && event.button == 2) { alert(message); return false; } } document.onmousedown = rtclickcheck; </script> |
|||
|
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)





