我正在使用Galleria Fullscreen主题,不允许通过jQuery保存为图像(禁用右键单击)。这段代码:
$('img').live('contextmenu', function(e){
return false;
});
此代码适用于Firefox,Safari和Chrome Mac。我在Windows上测试过,不允许右键单击。但是当按下Windows键时,获取另存为图像。这是关键:
如何禁用此密钥?
答案 0 :(得分:5)
你不能。
此外,值得注意的是,鉴于网络的本质所有,您的网站内容将被下载并保存在客户端的计算机缓存中(假设他们启用了它)。总会有一种方法可以将在线找到的文件保存到本地计算机上。
如果您不希望某人下载您的图片或在没有信用的情况下使用它们,请将它们加水印,或者不要将它们放在网上。
答案 1 :(得分:4)
答案 2 :(得分:1)
在我的网站上,我使用了这样的脚本
///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")
我跳它可以帮助你的情况: - )