logo
g Text Version
Beauty & Self
Books & Music
Career
Computers
Education
Family
Food & Wine
Health & Fitness
Hobbies & Crafts
Home & Garden
Money
News & Politics
Relationships
Religion & Spirituality
Sports
Travel & Culture
TV & Movies

dailyclick
Bored? Games!
Nutrition
Postcards
Take a Quiz
Rate My Photo

new
Action Movies
Bible Basics
Houseplants
Romance Movies
Creativity
Family Travel
Southwest USA


dailyclick
All times in EST

Full Schedule
g
g HTML Site

BellaOnline's HTML Editor

g

Protect Your Content with No Right Clicks

Guest Author - Diane Cipollo

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.

<tag element oncontextmenu = "handler">
<span oncontextmenu = "return false">...</span>
<body oncontextmenu = "return false">

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

Table Test Box






This site needs an editor - click to learn more!

Add Protect+Your+Content+with+No+Right+Clicks to Twitter Add Protect+Your+Content+with+No+Right+Clicks to Facebook Add Protect+Your+Content+with+No+Right+Clicks to MySpace Add Protect+Your+Content+with+No+Right+Clicks to Del.icio.us Digg Protect+Your+Content+with+No+Right+Clicks Add Protect+Your+Content+with+No+Right+Clicks to Yahoo My Web Add Protect+Your+Content+with+No+Right+Clicks to Google Bookmarks Add Protect+Your+Content+with+No+Right+Clicks to Stumbleupon Add Protect+Your+Content+with+No+Right+Clicks to Reddit




RSS | Editor's Picks Articles | Top Ten Articles | Previous Features | Site Map


For FREE email updates, subscribe to the HTML Newsletter


Past Issues


print
Printer Friendly
bookmark
Bookmark
tell friend
Tell a Friend
forum
Forum
email
Email Editor


Content copyright © 2014 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.

g


g features
What's Coming in HTML 5

What is FTP?

HTML Fundamentals - Tables

Archives | Site Map

forum
Forum
email
Contact

Past Issues
memberscenter


vote
Poetry
Daily
Weekly
Monthly
Less than Monthly



BellaOnline on Facebook
g


| About BellaOnline | Privacy Policy | Advertising | Become an Editor |
Website copyright © 2014 Minerva WebWorks LLC. All rights reserved.


BellaOnline Editor