Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2008-04-25 11:26:52

dlbullock
New Member
Registered: 2007-12-02
Posts: 6

Disable Right Click

I want to use a script to disable right click functionality on images but wanted to know if anyone knew of one and if so where would I drop that code at? On a form? Thanks for your help.

Offline

#2 2008-04-25 12:14:46

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: Disable Right Click

Browsers can choose to ignore such restrictions. In other words: it doesn’t work.

Offline

#3 2008-04-25 13:31:24

uli
Moderator
From: Cologne
Registered: 2006-08-15
Posts: 4,306

Re: Disable Right Click

You can try and stretch a transparent 1×1px gif all across underlying images. But even this won’t keep people from making screenshots.


In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links

Offline

#4 2008-04-25 14:59:34

trenc
Plugin Author
From: ⛵️, currently Göteborg, SE
Registered: 2008-02-27
Posts: 574
Website GitHub

Re: Disable Right Click

Make a flash movie or print a book! All others will not work.


Digital nomad, sailing the world on a sailboat: 32fthome.com

Offline

#5 2008-04-25 17:41:22

Ruhh
Member
From: dakota dunes
Registered: 2008-01-20
Posts: 305

Re: Disable Right Click

Just watermark your images?


<txp:Ruhh />

Offline

#6 2008-05-15 03:12:58

immarabi
Member
Registered: 2008-04-29
Posts: 57

Re: Disable Right Click

uli wrote:

You can try and stretch a transparent 1×1px gif all across underlying images. But even this won’t keep people from making screenshots.

Do you mean put an image of 1 by 1 px over background images?

Offline

#7 2008-05-15 06:47:00

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: Disable Right Click

In firefox: extra -> page info -> tab: media -> select image -> save as

If a browser is allowed to get/show the image, the user can always find a way to save it.

Offline

#8 2008-05-15 09:01:55

uli
Moderator
From: Cologne
Registered: 2006-08-15
Posts: 4,306

Re: Disable Right Click

immarabi wrote:

Do you mean put an image of 1 by 1 px over background images?

Exactly. This won’t of course turn off the right click menu, but it’s the transparent gif that is saved then.

Last edited by uli (2008-05-15 09:03:44)


In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links

Offline

#9 2008-05-16 04:56:46

Mary
Sock Enthusiast
Registered: 2004-06-27
Posts: 6,236

Re: Disable Right Click

With jQuery you can do:

// disable right-click on images (but not on anything else)
$(document).ready(function(){
	$('img').bind('contextmenu', function(e){
		return false;
	});
});

But it’s really only good for slowing down the ignorant (of both browsers and copyright).

Offline

#10 2008-05-16 11:47:21

keith
Member
From: Blyth, Northumberland, England
Registered: 2004-12-08
Posts: 199
Website

Re: Disable Right Click

uli wrote:

Exactly. This won’t of course turn off the right click menu, but it’s the transparent gif that is saved then.

Yeah, but then you can just pull the image URL out of the source code – I’ve just tested it on a friend’s “professional” Flickr account, which uses the transparent gif “security” feature.


Keith
Blyth, Northumberland, England
Capture The Moment

Offline

#11 2008-05-16 12:44:46

uli
Moderator
From: Cologne
Registered: 2006-08-15
Posts: 4,306

Re: Disable Right Click

Of course you can! You can be real evil!
Mary said it all: “Slowing down the ignorant”. And that’s what it should do.


In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links

Offline

#12 2008-05-17 02:56:16

immarabi
Member
Registered: 2008-04-29
Posts: 57

Re: Disable Right Click

Mary wrote:

With jQuery you can do:

// disable right-click on images (but not on anything else)
$(document).ready(function(){
	$('img').bind('contextmenu', function(e){
		return false;
	});
});

So I downloaded jQuery and uploaded to the FTP.

But what else do I need to get this script to work? I added it like this in the <head> section
<script type=“text/javascript” src=“http://www.shattuckart/js/jquery.js”></script>
<script type=“text/javascript”> // disable right-click on images (but not on anything else)
$(document).ready(function(){ $(‘img’).bind(‘contextmenu’, function(e){ return false; });
}); </script>

But it still doesn’t work

Offline

Board footer

Powered by FluxBB