...

View Full Version : Disabling Right Click Mouse



Abd
12-11-2002, 04:29 PM
Hi all,

please does anyone knows how to write a script that will disable right clicking on a web page?

Abd

MrDoubtFire
12-11-2002, 04:32 PM
<script language=JavaScript>
<!--

//Disable right mouse click Script
//By Maximus (maximus@nsimail.com) w/ mods by DynamicDrive
//For full source code, visit http://www.dynamicdrive.com

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>



You can get these anywhere. This one was from dynamicdrive (http://www.dynamicdrive.com).

MrDoubtFire

zoobie
12-11-2002, 07:26 PM
Left-handers love those...:rolleyes:

cg9com
12-11-2002, 08:07 PM
Abd,
once you learn more about web design, coding and the like.
you will realize that you wont need or want a no right click script ;)

if you continue extending your knowledge on the whole web coding thing, you will find that time will have proven me right.

BusterLee
12-11-2002, 08:34 PM
I have to agree...

When I first started all I wanted to do was protect images....

You soon find out it is useless and makes people more persistent!!

cg9com
12-11-2002, 09:22 PM
Originally posted by BusterLee

You soon find out it is useless and makes people more persistent!!
haha your exactly right, when i see someone using waaay to many novelty javascripts to protect there pages, i just want to grab the source and email it to them :cool:

HTMLcrazy
12-12-2002, 12:02 AM
There is no way to truly protect images, or anything else online for that matter. There's always going to be someone ahead of the game who will figure a way around it.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum