|
-
Dec 24th, 2000, 05:19 PM
#1
Thread Starter
Addicted Member
Hi folks,
could one of you kind people please provide me with a script that defeats someone from right-clicking an image to save it, so that I can protect some of my hard work.
Thanks in advance
Merry Christmas
GRAHAM
-
Dec 24th, 2000, 09:10 PM
#2
Code:
<HTML>
<BODY oncontextmenu="return false">
<IMG SRC="img.gif">
</BODY>
</HTML>
but people ca always go to view->source, see where the pic is located, and download it.
-
Dec 25th, 2000, 03:56 PM
#3
Thread Starter
Addicted Member
Thanks very much Dennis,
I did have a short JavaScript written down somewhere
(can't find it)that brought up a message box stating "sorry this image is copyright" when an image was right clicked, that replaced the 'save as' dialog box.
Would you or anyone else be able to provide me with something similar in JS.
cheers
GRAHAM
-
Dec 25th, 2000, 04:40 PM
#4
sure...
Code:
<HTML>
<HEAD>
<script LANGUAGE="JavaScript1.1">
<!--
var ns4 = (document.layers)? true:false
var ie4 = (document.all)? true:false
function press(e) {
if ((ns4 && (e.which == 3 || e.which == 2)) || (ie4 && (event.button == 2 || event.button == 3))) {
alert ("Stop trying to steal my pictures...what's wrong with you anyway?")
return false
}
return true
}for (var i=0; i<document.images.length; i++) document.images[ i ].onmousedown=press
for (var i=0; i<document.links.length; i++) document.links[ i ].onmousedown=press
document.onmousedown=press
if (ns4) window.captureEvents(Event.MOUSEDOWN)
window.onmousedown=press
//-->
</script>
</head>
<BODY oncontextmenu="return false">
testing
<IMG SRC="img.gif">
</BODY>
</HTML>
-
Dec 25th, 2000, 05:11 PM
#5
Thread Starter
Addicted Member
BRILLIANT..
Thanks alot Dennis,
I,ll go and give that a whirl now.
Merry Xmas and a Happy New Year to you Dennis
and the same to all the Forum members and Admins.
especially those of you who have helped me over the past year or so,
GRAHAM
-
Dec 26th, 2000, 12:45 PM
#6
Will the above solution prevent someone from
saving the whole web page as Web Page?
If not, all immages would be saved in separate folder
for the thief.
-
Dec 26th, 2000, 10:16 PM
#7
Thread Starter
Addicted Member
Hi again,
Point taken Sadovod, I suppose if someone's really determined they'll find a way no matter what. At least the visitor will be informed that the image is copyright, not that it matters to some people today, as they steal complete sites from what I've seen and heard.
MasterGoon, if you can find such a script I would appreciate a copy of it.
I managed to find my original script after, it's not up to par with Dennis's script, but achieves the same end
<script language="JavaScript">
<!--
function click() {
if (event.button==2) {
alert('Copyright etc, etc')
}
}
document.onmousedown=click
// -->
</script>
Cheers all
GRAHAM 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|