How To Disable 'save Image As' Option On Right Click?
I want to prevent users from right-clicking on image on my site and saving them. I know there are many work-around for this, but I still need to do it. Any help? Also, this site ha
Solution 1:
$("body").on("contextmenu", "img", function(e) {
returnfalse;
});
This is the "new" way in jQuery. Bear in mind anyone with technical knowledge would be able to get around this.
Solution 2:
Use the image as a background-image of a div element, This will keep the easy minded people away from saving it ;)
Solution 3:
<scripttype="text/javascript">functionclick (e) {
if (!e)
e = window.event;
if ((e.type && e.type == "contextmenu") || (e.button && e.button == 2) || (e.which && e.which == 3)) {
if (window.opera)
window.alert("");
returnfalse;
}
}
if (document.layers)
document.captureEvents(Event.MOUSEDOWN);
document.onmousedown = click;
document.oncontextmenu = click;
</script>
I have found this script on selfhtml.org.
This function is originally designed to disable the client side context menu and to insert your own context menu. But it can be used for this too.
But keep in mind: By using browser addons like NoScript or opening the image url user could get around this.
Post a Comment for "How To Disable 'save Image As' Option On Right Click?"