I'm trying to find a code that'll prevent right-clicking on a webpage, mainly to protect my images (self-made, current one was drawn by me too so I don't want anyone nicking it) ... anybody out there know the code?
Thanks in advance ^^
amyaurora
05-22-2006, 04:12 PM
Here is one. Just add instead your <body> tags.
<script language=JavaScript>
<!--
//Disable right click script III- By Renigade (renigade@mediaone.net)
//For full source code, visit http://www.dynamicdrive.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>
Gymfan15
05-22-2006, 04:59 PM
Please be aware that this method is not fool-proof; I am no computer genius but I can easilly bypass this and get at any photo. Of course, I only do this when I have the webmaster's permission (to snag photos from a protected gallery, for instance), but other people may not be so honest.
Here is one. Just add instead your <body> tags.
nothing should replace the BODY tags.
javascripts such as this one should be put into the HEAD area of your coding.
as the previous poster mentioned however, there is zero way to save your images. any image editor that has a screen capture is able to get your images 100% of the time.
using javascript is a very very low security.
amyaurora
05-23-2006, 07:48 AM
I meant to type inside not instead.
*looks like a silly goose for making an obvious boo-boo*
I agree that javascript is low security. Such a pity too.
nothing should replace the BODY tags.
javascripts such as this one should be put into the HEAD area of your coding.
as the previous poster mentioned however, there is zero way to save your images. any image editor that has a screen capture is able to get your images 100% of the time.
using javascript is a very very low security.
Hmm, I know it's possible to get at images (hence the use of my watermark in a spot that will make it obvious if it's taken out) no matter what's added into the page's coding, I just want to add one more little difficulty to getting at it.
Thankies for the javascript, I'll give it a go ^^
good. apart from not posting images at all, watermarking is a very good deterrent.