Prevent Image Copying - Prevent Right Click
   
Home
 
Books
 
File Formats
 
Glossary
 
Software
 
Tutorials
     
GraphicsAcademy.com  >  Tutorials  >  Prevent Image Copying  >  Chapter 1

How To Prevent Image Copying

Chapter 1: Prevent Right Click

Probably the most common way to prevent copying is to use a little JavaScript to prevent users right clicking on an image and doing Save As...
(If you're not familiar with JavaScript or just want to learn more, then get yourself a good JavaScript Tutorial).

Below is an example of such code (insert it in the <HEAD> section of your HTML pages). Unlike most code of this type (most people seem to get it wrong), this should code work with both with Netscape and Internet Explorer.

<SCRIPT LANGUAGE="JavaScript"><!--
var message = 'Please respect our Copyright.' ;
function clickie() {
if (document.all) {
alert(message);
return false; } }
function clickns(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=clickns;
} else {
document.onmouseup=clickns;
document.oncontextmenu=clickie;
}
// --></SCRIPT>


This idea works reasonably well but it's not totally secure: users can get around it by (for example) disabling JavaScript.

Another issue with this script is that it can be kind of annoying:
  • The script displays a message if the user does try to right-click. Some webmasters might prefer to simply silently prevent right-clicks.

  • Users are forbidden to right-click anywhere on the web page. This stops "legitimate" right clicks (for example to open an image in a new browser window).
Of course, you can improve the script fix these annoyances... but you'll want to do so in a way that works with both Netscape and Internet Explorer... so if you prefer an easy life, you'll probably prefer to use Image Protection Rocket to generate the exact type of anti-right click script that you want.




  
How To Prevent Image Copying:
 
 
  << PreviousIntroduction   1   2   3   4   5Next >>  
   


 
   
 
Privacy     Terms Of Use

Copyright © 2005-2008, Answers 2000 Limited

With any business, it is up to the individual owner of said business to ensure the success of the business. You may make more or less than any sample figures or results that might be quoted on our web sites or other publications. All business involves risk, and many businesses do not succeed. Further, Answers 2000 Limited does NOT represent that any particular individual or business is typical, or that any results or experiences achieved by any particular individual/business is necessarily typical.

In Association With Amazon.com
All trademarks are property of their respective owners.
All third party content and adverts are copyright of their respective owners.

Some graphics on our web sites are Copyright (C) 1997-2000 Hemera Technologies Inc., and used under license. All such pictures are provided for viewing purposes only and are not to be saved or downloaded. All such pictures of recognizable individuals are models and used for illustrative purposes only, and not meant to imply any association or endorsement of said individual with any product or service.