View Full Version : Code help for web


itsjustme
10-30-2007, 03:00 AM
I have to disable right clicking on a web page...I have the code but it didn't work when I put it in the site. Does it need to go somewhere specific?

(code)

<SCRIPT LANGUAGE="JavaScript1.1">
<!-- Original: Martin Webb (martin@irt.org) -->

<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! JavaScript Source: Free JavaScripts, Tutorials, Example Code, Reference, Resources, And Help (http://javascript.internet.com) -->

<!-- Begin
function right(e) {
if (navigator.appName == 'Netscape' &&
(e.which == 3 || e.which == 2))
return false;
else if (navigator.appName == 'Microsoft Internet Explorer' &&
(event.button == 2 || event.button == 3)) {
alert("Not here! ");
return false;
}
return true;
}

document.onmousedown=right;
document.onmouseup=right;
if (document.layers) window.captureEvents(Event.MOUSEDOWN);
if (document.layers) window.captureEvents(Event.MOUSEUP);
window.onmousedown=right;
window.onmouseup=right;
// End -->
</script>

Juke
10-30-2007, 07:21 PM
Simply add the following code to the <BODY> section of your web page (Press Ctrl C after selecting code to copy it):

<script language=JavaScript>
<!--
//Disable right click script III- By JUkE (hackergod71@hotmail.com)
//
var message="";
///////////////////////////////////
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.oncontext menu=clickIE;}
document.oncontextmenu=new Function("return false")
// -->
</script>

itsjustme
10-30-2007, 07:29 PM
I'm going to assume that the 'Information Technician' under your name means you know what you are doing...right? Using another code is a bit scary.

Osirus
10-30-2007, 07:48 PM
What cms are you running? For vbulletin you will want to put the code at the top of the header template, Ipb at the top of the global_board_header template. If that code doesn't work correctly there is also a disable hotlink mod

Juke
10-31-2007, 10:30 PM
im taking it that he is working with html and not php