Karmacoma
Karmacoma

Reputation: 668

Disable save as key for images

I'm using Galleria Fullscreen theme and don't allow save as image (disable right click) via jQuery. This code:

$('img').live('contextmenu', function(e){
    return false;
});

This code working Firefox, Safari and Chrome Mac. I tested on Windows and don't allow right click. But when push a Windows key, get Save As Images. This is key:

enter image description here

How can I disable this key?

Upvotes: 0

Views: 973

Answers (3)

CMMaung
CMMaung

Reputation: 165

In my website I used the script like this

    ///Disable Right Click
    var message = "Sorry! We are not allowed right click for SECURITY REASON.";

    ///////////////////////////////////
    function clickIE4() {
        if (event.button == 2) {
            alert(message);
            return false;
        }
    }

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

    if (document.layers) {
        document.captureEvents(Event.MOUSEDOWN);
        document.onmousedown = clickNS4;
    }
    else if (document.all && !document.getElementById) {
        document.onmousedown = clickIE4;
    }

    document.oncontextmenu = new Function("alert(message);return false")

I hop it can help your case :-)

Upvotes: 1

gdoron
gdoron

Reputation: 150293

enter image description here

"Humor should be allowed if they are answering the question." meta

The real answer, is that you can't.

Upvotes: 4

Rory McCrossan
Rory McCrossan

Reputation: 337691

You can't.

Also, it's worth noting that given the very nature of the web all the content of your website will be downloaded and saved on the client's machine in their cache (assuming they have it enabled). There will always be a method of saving a file found online to a local machine.

If you don't want someone to download your images or use them without credit, either watermark them, or don't put them online.

Upvotes: 4

Related Questions