Protect Your Content with No Right Clicks
This past week, I received an email from a man who sells comic books on eBayR and has had several cases of theft of his images. He wanted to prevent people from coping his images from his site. I wrote back with several suggestions including the use of DHTML script, FlashR and watermarking his images. He was especially interested in using the script method because he didn't want to obscure the images with a visible watermark and an embedded watermark didn't solve his problem either. There are several scripts that have been used over the years but none of these work in every web browser. That limitation aside, the one I have the best luck with is the inline oncontextmenu event handler which works in most newer browsers (Internet Explorer 5 or higher). Boy is that a mouth full! Well, it's very easy and versatile to use. There is only one line of code and, depending on where you place the code, it can prevent the pop-up context menu throughout the entire webpage or just a section of the page. This pop-up menu has the dreaded commands; Save Picture As, Email Picture, Print Picture, Set As Background, Copy Image and Covert to Adobe PDF. The code is the same for both methods.
How Does It Work The code which is called an event handler is placed inside an HTML tag. The event is the right click and the default action is the pop-up menu. However, you will use this simple code to change the default behavior by setting the returnValue property to false. To use this on the entire webpage, just place the code in the body tag. To use it on just a section of the page, you can place it inside a location specific tag such as a span, div or table tag. Try the right click on the test boxes below. Span Test Box Div Test Box
| ||
This site needs an editor - click to learn more!
Editor's Picks Articles
Top Ten Articles
Previous Features
Site Map
Content copyright © 2023 by Diane Cipollo. All rights reserved.
This content was written by Diane Cipollo. If you wish to use this content in any manner, you need written permission. Contact
BellaOnline Administration
for details.