How to disable the right mouse button on images (Opera)

L

Lijun Yang

Hey, I am able to disable the right mouse button on images for netscape
and IE but it won't work for Opera.

Here is the code:

// start of the code

var clickmessage="Sorry, you don't have permission to right-click."

function protectImages () {
if (document.all)
document.oncontextmenu=disableclick
else if (document.getElementById)
document.oncontextmenu=disableclick
else if (document.layers)
associateimages()
}

function disableclick(e) {
if (document.all) {
if (event.srcElement.tagName=="IMG"){
alert(clickmessage);
return false;
}
}
else if (document.layers) {
if (e.which == 3) {
alert(clickmessage);
return false;
}
}
else if (document.getElementById){
if (e.target.tagName=="IMG"){
alert(clickmessage)
return false
}
}
}

function associateimages(){
for(i=0;i<document.images.length;i++)
document.images.onmousedown=disableclick;
}

// end of code ----

My question is:

How do I make the code work for Opera 7.x?

Thanks in advance.

--
Lijun

=======================================================
Lijun Yang
mailto: (e-mail address removed)
=======================================================
 
L

Lasse Reichstein Nielsen

Lijun Yang said:
Hey, I am able to disable the right mouse button on images for netscape
and IE but it won't work for Opera.

Good. That is one of the reasons I like Opera.
var clickmessage="Sorry, you don't have permission to right-click."

My reply to getting a message like that, would be ... not printable in
a public forum.

Give up. Whatever you are trying to do, it won't work against anybody
with half a clue. If you don't want people to save your images, don't
put them on the web.
How do I make the code work for Opera 7.x?

You are not supposed to be able to interfere with my browsers
interface.
If you find a way, please tell us, so we can have the bug fixed.

/L
 
L

Lijun Yang

DU said:
You're only annoying your own visitors and users. In Netscape and IE,
you're preventing them from accessing 11 menu item commands in Netscape
and Mozilla-based browsers and 17 menu items commands from the context
menu; only 1 of these commands is about saving the image.

There are at least 3 different ways to copy images besides the right
click. Nothing you do here can nor will prevent them from copying your
images.

How do I disable the mouse right-click?
http://www.html-faq.com/scriptingbasics/?disablerightclick

How do I prevent visitors stealing my images?
http://www.html-faq.com/webdesign/?stealingimages

DU
--
Javascript and Browser bugs:
http://www10.brinkster.com/doctorunclear/
- Resources, help and tips for Netscape 7.x users and Composer
- Interactive demos on Popup windows, music (audio/midi) in Netscape 7.x
http://www10.brinkster.com/doctorunclear/Netscape7/Netscape7Section.html

My point is not whether I will annoy visitor or not, but whether I can
do it or not technically with Opera.

--
Lijun

=======================================================
Lijun Yang
mailto: (e-mail address removed)
=======================================================
 
L

Lijun Yang

Lasse said:
Good. That is one of the reasons I like Opera.


My reply to getting a message like that, would be ... not printable in
a public forum.

Give up. Whatever you are trying to do, it won't work against anybody
with half a clue. If you don't want people to save your images, don't
put them on the web.


You are not supposed to be able to interfere with my browsers
interface.
If you find a way, please tell us, so we can have the bug fixed.

/L

My point is not whether I will put the iamges on net or not, but whether
I can do it or not technically with Opera.

--
Lijun

=======================================================
Lijun Yang
mailto: (e-mail address removed)
=======================================================

--
Lijun

=======================================================
Lijun Yang
mailto: (e-mail address removed)
=======================================================
 
L

Lasse Reichstein Nielsen

My point is not whether I will put the iamges on net or not, but whether
I can do it or not technically with Opera.

The answer to that was no. With an attached "luckily".

/L
 

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,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top