HTML Code

steviejay

Now in Black and White!!
Joined
Jun 9, 2002
Messages
3,343
Location
Glasgow, Scotland
could anyone show me some place where I could find HTML code which would allow me to block the right click and a message appearing whenever it is clicked. I'm trying to prevent someone from stealing pictures from this site I'm working on. I know there are other ways to get pics from sites but I'm just trying to make it difficult

Steviejay
 
You cannot stop anyone stealing images. No amount of JavaScript will disable "Print Screen" and nor will it work if they disable JavaScript, or look in the source code, or do any of hundred other simple workarounds to avoid the popup message.

The right click popup is just incredibly anoying to people who want to "open in new window" or scroll the page or something like that.

I strongly recommend you watermark the image instead.

As I discourage it, I'm sorry to say I haven't checked this works...
Code:
<body oncontextmenu="alert('Please do not copy my images');"></body>

In either event, you would use something similar. The following definately works.. :p

Code:
<body onclick="alert('This site is not surfer friendly, please go away.');"></body>
 
If your host allows it. Investigate .htaccess and referral blocking. This can be used to prevent people displaying your images in their sites and burning up your bandwidth.
 
Here's one I just thought of...

Code:
<img src="myImage.png" onmousedown="this.src='message.png';" onmouseout="this.src='myImage.png';">

When they click on an image, the image changes to something else (i.e. these images are protected) and when the mouse moves away, the image changes back to what it should be.

Might be funny. Still won't stop anyone using print screen, or copying the file from their browser's temp folder..
 
:) yeah the images are watermarked. but I talked it over with my employer and he agrees that a warning sign would better disuade anyone trying to get the images.

So I'm planning on putting the watermarks and also put a right click blocker.

Thanks for the help
 
Yeah, go ahead and use it, although it is more trouble than it is really worth and usually makes browsing an annoyance.

People can easily steal the images in quite a few ways:
As someone mentioned, hit the print screen button.
Another way is to hit the right click equivalent on the keyboard and do the same function.
Look at the source code and find the link to the image.
Check your temporary internet files.

Anyhow, hopefully it will help to stop people.
 
What may work is...

1) Use a script to make it awkward to copy image without making the site awkward to browse
2) Have a extremely convenient form to request (better quality) images

So you don't stop people taking them, but you do know who/where/when which is lot healthier imo, and everyone knows they saw the copyright notice.

Btw, I won't browse a site that messes with my mouse buttons. It may serve only to reduce site popularity and I don't think that would be the objective.
 
If you want a site that is extremely difficult to have images and code stolen, just code the entire thing using Flash.

Or, make your pictures in a flash insert in the HTML window so that no one can have access to the images at all.
 
Back
Top Bottom