[Javascript] Disable left mouse click and drag on images

Troy III Ajnej trojani2000 at hotmail.com
Fri Jul 21 15:05:24 CDT 2006


Alan,
This problem has been discussed earlier in this forum, but I don't remember
the conclusions.
 
FIRST STEP  -  (Preventing Browser cache)
 
<HTML>
<HEAD>
<META HTTP-EQUIV="Expires" CONTENT="-1"><META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE">
 
</HEAD>
<BODY><DIV style="width:200; height:128; background-image:url('precious.jpg')"></div></BODY>
<HEAD>
 
<META HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE">
 
</HEAD>
</HTML>
 
This code has a triple action against browser caching.
(Keep it exactly as is - yes, both headers in the same order of document flow)
|||||||This code will suffice for Opera 9 - no other actions required|||||||||
 
SECOND STEP  -  (Clearing RAM, unloading images on suspicious user action)
 
<SCRIPT> var alles=document.getElementsByTagName("DIV") 
 var tmpImages=new Array();
 
    for(i=0;i<alles.length; i++){
        tmpImages[i] = alles[i].style.backgroundImage  }  
function clearRAM(){    for(i=0; i<alles.length; i++){        alles[i].style.backgroundImage = "url(imageoffline.jpg)"//you may chose to either leave it empty or give a warning image         }      }
function restoreImages(){    for(i=0;i<alles.length;i++){        alles[i].style.backgroundImage = tmpImages[i]  } }
 
onblur = clearRAMonfocus = restoreImages
</SCRIPT>
 
|||||||This code will suffice for IExplorer - no other actions required|||||||||
In Explorer client case, this script will not allow to even click on the image. So, the context menu options like:
 "save background as"; "set as background" & "copy background", will only give the opportunity to save the 
warning image since it will  be switched immediately. 
In Firefox/Navigator
This code will clear/replace all the background images with the copyright warning image in case the user
goes for: Tools/ Page Info ... Media Tab/Save As in Firefox or Navigator thanks to the Options Box receiving focus.Same will do in case the user goes for File /Save As ...complete page.
So far so good, but there is one last hole:
Firefox special Context Menu Option "View Background Image", is designed to act as a complete bitch.
This option will blow off all we have achieved in previous steps. Allowing user to navigate to a new page 
containing the protected image caught offguard.
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!  Netscape/Firefox not solved !!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Since mozillas event model has always been a week point, we are forced to use a non scripting solution for it.
Unclean workaround of displaying fully transparent gifs on top of these backgrounds. For now of course...
 
THIRD STEP - JavaScript Disabled
(Denying javascript disabled browsers from viewing images unless they decide to enable it)
As we can see. We have another door OPEN: the script disabled client browser.
A hard coded HTML with a clear message like: "This page can not display properly with Javascript disabled, blla blla blla"
Should be used. Than you should decide how to make these images available to the browser render engine through script
You can decide for, either using css visibility/display or set background properties dynamically with javascript during runtime.THE SCREEN CAPTURE ISSUE - my last cent
Since almost all screen capture applications along with the "print screen" are invoked with a key stroke, we can use
key down event to call the clearRAM function just in time before the actual capture takes place. So there will be no 
screen capturing either.
 
 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~                                         Troy III                           progressive art enterprise~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


From: alaneaston666 at hotmail.comTo: javascript at LaTech.eduDate: Fri, 21 Jul 2006 09:58:26 +0100Subject: [Javascript] Disable left mouse click and drag on images

Hello People,
 
Now I know the issues surrounding trying to stop people stealing images off your website, it basically cannot be done, you can make life awkward, but essentially it cannot be done.
 
Well, I have a client who wants me to make it as difficult as possible for any visitor trying to save their images.
 
I have disabled right-click on images, but you can still left click on an image, and drag it to either the location bar, then save it once the image shows, or drag it to your desktop.
 
Question is, does anyone have a trick that I can use to stop this "left-click and drag" on images....????
 
Any help would be appreciated.
 
Alan...
_________________________________________________________________
Express yourself: design your homepage the way you want it with Live.com.
http://www.live.com/getstarted
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.evolt.org/pipermail/javascript/attachments/20060721/14d1b1f1/attachment.htm>


More information about the Javascript mailing list