You can search google for "disable right click JavaScript" and you get the code, but there are other options too like holding the shift key and clicking the link!
Plus browser now can disable code that disables the right click function making it not work. Plus what if JavaScript is disabled.
Yes, But I want to disable "open in new window" only on the hyperlinks on that page. The soln, I have right now even disables it, whenever it is right clicked any where in the page..
Just copy and paste this code inside the body of the html page.
<script language="JavaScript1.2">
var clickmessage="Right click disabled on hyperlinks !!! "
function disableclick(e) { if (document.all) { if (event.button==2||event.button==3) { if (event.srcElement.tagName=="A"){ alert(clickmessage); return false; } } } else if (document.layers) { if (e.which == 3) { alert(clickmessage); return false; } } else if (document.getElementById){ if (e.which==3&&e.target.tagName=="A"){ alert(clickmessage) return false } } }
function associatelinks(){ for(i=0;i<document.links.length;i++) document.links[i].onmousedown=disableclick; }
if (document.all) document.onmousedown=disableclick else if (document.getElementById) document.onmouseup=disableclick else if (document.layers) associatelinks() </script>