Newbie: Trouble with disabling rightclick on popup

S

Steven Choo

Hi , I'm a beginner to all this so please bear with me. I would like
to disable right clicking on an enlarged image that appears in a popup
when a thumbnail is clicked. I have tried to amend this free add-in
but it haven't got it to work. Can anyone help? Much appreciated.

<script language="JavaScript">
<!--
function spawnJimcoPopup(url, name, options, w, h, x, y, scaleType)
{
var windowOptions;
if (scaleType == 'percent')
{
w = (w * screen.availWidth) / 100;
h = (h * screen.availHeight) / 100;
}
if (x == 'center')
{
x = (screen.availWidth - w) / 2;
y = (screen.availHeight - h) / 2;
}
windowOptions = options + ',width=' + w + ',height=' + h + ',left='
+ x + ',top=' + y;
newWindow = window.open(url, name, windowOptions);
newWindow.document.open();
newWindow.document.write("<html><head><title>Enlarged
Picture</title></head>");
newWindow.document.write("<body oncontextmenu='return false'
onselectstart='return false' ondragstart='return false'
bgcolor='#FFFFFF' text='#000000' topmargin=5 LEFTMARGIN=5
MARGINHEIGHT=5 MARGINWIDTH=5>");
newWindow.document.write("<p align=center><a
onclick='window.close()'><img src=" + url + " alt='Click on pic to
close' border='0'></a></p>");
newWindow.document.write("</body></html>");
newWindow.document.close();
newWindow.focus();
}
//-->
</script>
 
F

Fabian

Steven Choo hu kiteb:
Hi , I'm a beginner to all this so please bear with me. I would like
to disable right clicking on an enlarged image that appears in a popup
when a thumbnail is clicked. I have tried to amend this free add-in
but it haven't got it to work. Can anyone help? Much appreciated.

Even if you get it to work, it is trivial for anyone who wants to take
that image to override the javascript. There are more effective ways to
protect your work. Copyright notices for example.
 
K

kaeli

Hi , I'm a beginner to all this so please bear with me. I would like
to disable right clicking on an enlarged image that appears in a popup
when a thumbnail is clicked. I have tried to amend this free add-in
but it haven't got it to work. Can anyone help? Much appreciated.

Why?
I can still steal it with ease and many (often disabled) users who use
that right-click menu to navigate will be much put out.

You can try digital watermarking, but those are removable with the right
software. Relatively few users have such software.
Your best bet is to put a copyright text on the lower right hand side of
the image in a spot that is hard to remove (without mucking up the
image) with an image editor.
Second best bet is to make it a table background with a spacer gif over
it so that users who try to save it get the spacer. Even better, make it
an anchor, too, so that any click on it tries to do something other than
drag and drop (for users who might try to drag and drop into an image
editor). Savvy users can still easily read your html and get the image
name and load it that way (from the cache or server), but relatively few
people will bother to do this.

If everything else fails, people who want your stuff can simply screen
capture it. Quality goes down, but with a decent computer, it doesn't go
down *that* much unless you're using high quality bitmaps or something.

--
 
R

rf

Steven Choo said:
Hi , I'm a beginner to all this so please bear with me. I would like
to disable right clicking on an enlarged image that appears in a popup
when a thumbnail is clicked. I have tried to amend this free add-in
but it haven't got it to work. Can anyone help? Much appreciated.
<snip script>

Don't forget to disable left clicking as well, that is what I use to
drag/drop an image to my image editor.

Cheers
Richard.
 
F

Fabian

rf hu kiteb:
<snip script>

Don't forget to disable left clicking as well, that is what I use to
drag/drop an image to my image editor.

While you're at it, you might want to disable the print screen button
too, as that is what I use to copy it to the clipboard. And better not
include the url anywhere in the source, because I can get your picture
source by looking at that.
 
M

McKirahan

Steven Choo said:
Hi , I'm a beginner to all this so please bear with me. I would like
to disable right clicking on an enlarged image that appears in a popup
when a thumbnail is clicked. I have tried to amend this free add-in
but it haven't got it to work. Can anyone help? Much appreciated.


The following JavaScript disables right-click:

function click() {
if (event.button == 2) alert('This function has been disabled.')
}
document.onmousedown = click;
 
L

Lasse Reichstein Nielsen

McKirahan said:
The following JavaScript disables right-click:
function click() {
if (event.button == 2) alert('This function has been disabled.')
}
document.onmousedown = click;

No it doesn't. Not in *any* browser I am aware of.

In my primary browser, Opera, it simply does nothing. Right click is
reserved for the browser interface and is not available to the page
(unless I set a setting somewhere ... I don't remember where because
I have never needed it).
Same behavior in Mozilla Firebird (don't know if there is a setting
to allow the page to take control)

In IE 6 you can click and hold the right mouse button, then the alert
pops up. Then you press return and it goes away. Then you release the
right mouse button, and the context menu appears.

In Netscape 4, the equivalent would be:
---
function click(event) {
if (event.which == 3) alert('This function has been disabled.')
}
document.onmousedown = click;
---
It still fails in the same way as IE (or even easier, it seems).

So, your code only has any measureable effect in IE, and it is
trivial to circumvent.


The one way that actually *works* in Mozilla and IE is:

document.oncontexmenu = function(){return false;}

It is even better, because you can put it on just a part
of the document:
<img src='mySecretPicture.png' oncontextmenu="return false;">

It still won't stop anybody from saving images, and it will annoy
people who actually use their context menu. It's not worth it, putting
extra work into a page in order to make people think you are an idiot
(which is what people generally thing about removing the context menu).

/L
 
R

Richard Cornford

The following JavaScript disables right-click:

But not on that many browsers.
function click() {
if (event.button == 2) alert('This function has been disabled.')
}
document.onmousedown = click;

And the following bookmarklet restores it:-

Javascript:void(document.onmousedown=null);

Richard.
 
W

Warren Sarle

rf hu kiteb:


While you're at it, you might want to disable the print screen button
too, as that is what I use to copy it to the clipboard. And better not
include the url anywhere in the source, because I can get your picture
source by looking at that.

Shouldn't you disable the whole keyboard to prevent people from
using keyboard shortcuts for favorites, menus, etc.?
 
T

Thomas 'PointedEars' Lahn

Warren said:
Shouldn't you disable the whole keyboard to prevent people from using
keyboard shortcuts for favorites, menus, etc.?

U |_4|\/|3|2! This would obviously not help. You need to disable *any*
input device, including all types of pointing devices (not only a mouse
button), since they could be used to change the top application in a
windowed GUI to an evil snapshot program running in the background or to
do other nasty things like that!!1

And -- readers are recommended to fasten their seatbelts before going on
-- why don't you just create the website that can only be used with the
restricted user agent you provide for download there (in the unlikely
case it is currently not used)? That would be something completely new
&& |_||_7|241337!!!!111


PointedEars
 
R

Randy Webb

Thomas 'PointedEars' Lahn wrote:

And -- readers are recommended to fasten their seatbelts before going on
-- why don't you just create the website that can only be used with the
restricted user agent you provide for download there (in the unlikely
case it is currently not used)? That would be something completely new
&& |_||_7|241337!!!!111

Actually, AOL has been doing that for years now. A user has limited
access to AOL on the website (www.aol.com) but the majority of AOL
content is only accessible using the AOL software. And 99% of the
content on AOL is web-based now.
 
A

Alex Fitzpatrick

Randy said:
Thomas 'PointedEars' Lahn wrote:




Actually, AOL has been doing that for years now. A user has limited
access to AOL on the website (www.aol.com) but the majority of AOL
content is only accessible using the AOL software. And 99% of the
content on AOL is web-based now.
um, sarcasm?

<shakes head sadly>
 
R

Randy Webb

Alex said:
um, sarcasm?

<shakes head sadly>

When using sarcasm, one should use examples that are not true in real
life, thus the sarcastic value is lost, no?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,767
Messages
2,569,572
Members
45,046
Latest member
Gavizuho

Latest Threads

Top