Hi Guys,
I have an image set up, and when you left-click on it, the image closes.
I was wondering if there is an onRightClick event or something like that, so I can disable the right-click menu?

I'm trying to prevent people from being able to easily save the image.

Any ideas?

It can't be done.

Even if you were able to disable all forms of browser controls which save images, the print screen function always saves the visible screen to the clipboard. Then you can paste the screen to mspaint, cut out the image, and save it.

midiMagic.. Thanks for the response.
I know that there is always a way around everything, but I'm just trying to take away ONE option (and the most well known). Most people will try to right click-save as, and failing that, they'll give up.

There must be some way to detect a right-click.... I can program the rest from there

RockOn

Just a small hint for you. Make changes to suit your purposes since handing out complete solutions won't be such a good idea... ;-)

document.onmousedown=disableclick

function disableclick(e) 
{

    var message = "Right click is disabled";
    if (document.all) 
    {
        if (event.button==2||event.button==3) 
        {
            alert(message);
            return false;
        }
    }

    if(document.layers || document.getElementById && !document.all)
    {
        if (e.which == 3 || e.which == 2) 
        {
            alert(message);
            return false;
        }
    }
}

I would assume that you know where to place this code.

can i ask also about lightbox? i am also using that one. but my problem is when i mouse over the thumbnail picture, the caption was displayed but the code was also displayed.. im trying to put the comment one line after the other.. it worked but there's a problem when i used mouse over.. can someone help me? thank you..

Hi,

You can do this for only lightbox.

Replace the following code in lightbox.js,

Original:

Builder.node('div',{id:'imageContainer'}

Replaced:

Builder.node('div',{id:'imageContainer',oncontextmenu:'return false;'}

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.