logo-dw

Go Back   Dreamweaver Club Forums > Hand Coders Forum > Javascript and JS frameworks
Register FAQ Members List Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Display Modes
Old 04-19-2010, 06:26 PM   #1
walkamongus
walkamongus's Avatar
 
Join Date: Aug 2008
Posts: 145
Default no right click script

my client would like me to implement this code to disable right clicking on images... does the code look okay? And do i just place it in the header? Any help is much appreaciated

Code:
<SCRIPT language=Javascript1.2>
<!--
var message='Right Click Disabled .';
function click(e) {
if (document.all) {
if (event.button == 2) {
alert(message);
return false;}}
if (document.layers) {
if (e.which == 3) {
alert(message);
return false;}}}
if (document.layers) {
document.captureEvents(Event.MOUSEDOWN);}
document.onmousedown=click;
// -->
</SCRIPT>
</a>
walkamongus is offline   Reply With Quote
Old 04-19-2010, 07:32 PM   #2
d a v e
 
Join Date: Feb 2006
Location: finland
Posts: 1,684
Default

don't do it.
it annoys users makes pages less accessible and it's next to pointless.

js can easily be disabled
print screen
image taken from the cache...
waste of time for him, you and the user
d a v e is offline   Reply With Quote
Old 04-19-2010, 07:48 PM   #3
walkamongus
walkamongus's Avatar
 
Join Date: Aug 2008
Posts: 145
Default

thanks for the reply dave. yes, im aware of how pointless and annoying disabling right clicking is, explained it to my client as well, but he still wants it done :/ i was handed this code to use, but im not very java-savvy
walkamongus is offline   Reply With Quote
Old 04-19-2010, 08:35 PM   #4
domedia
Administrator
domedia's Avatar
 
Join Date: Dec 2003
Posts: 9,730
Default

Good grief..
The problem is that it's not only annoying for the visitors that will never come back, it's a guaranteed way to lose money.

In order to make the code work, place it in the header section of the website <head>, just make sure you don't bring along the closing </a>.

.
domedia is offline   Reply With Quote
Old 04-19-2010, 09:01 PM   #5
walkamongus
walkamongus's Avatar
 
Join Date: Aug 2008
Posts: 145
Default

thanks for the reply domedia. I placed it in the head but its not working for me. i found a similar code that works...

Code:
<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>
..but i would like to get the original code to work for the sake of pleasing the client. not sure what the problem is :/ any more help is appreciated

oh and i did away with that </a>

Last edited by walkamongus; 04-19-2010 at 09:11 PM..
walkamongus is offline   Reply With Quote
Old 04-19-2010, 09:18 PM   #6
domedia
Administrator
domedia's Avatar
 
Join Date: Dec 2003
Posts: 9,730
Default

I would just tell your client that the code he provided did not work, but that you went to the extra length of finding one that did.
Really should be no issue.
domedia is offline   Reply With Quote
Old 04-19-2010, 09:35 PM   #7
walkamongus
walkamongus's Avatar
 
Join Date: Aug 2008
Posts: 145
Default

Yeah you're probably right, thanks for the advice!
walkamongus is offline   Reply With Quote
Old 04-20-2010, 10:29 AM   #8
edbr
edbr's Avatar
 
Join Date: Aug 2005
Location: Bali
Posts: 11,176
Default

there are bucket loads of them if the client insists though

http://www.google.com/search?q=disab...GGL_en___ID330
__________________
If you're happy and you know it shake your meds!
different style links examples

Flight / Hotel search
Free script download
Bali Villas
edbr is offline   Reply With Quote
Old 04-20-2010, 05:18 PM   #9
d a v e
 
Join Date: Feb 2006
Location: finland
Posts: 1,684
Default

personally i would just refuse to do it
or do it and then go round to their place and show them how easy it is to take the image, along with some google searches of how easy it is to find ways of doing it.
d a v e is offline   Reply With Quote
Old 04-20-2010, 10:33 PM   #10
walkamongus
walkamongus's Avatar
 
Join Date: Aug 2008
Posts: 145
Default

hi edbr, thats how i found the dynamic drive script and it seems to be working "great".

dave, perhaps emailing them an article would have helped, but i spoke up about it twice, and its really up to them as far as im concerned.

anyway, thanks again everyone
walkamongus is offline   Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 02:05 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Copyright 2006 DreamweaverClub.com