Disabling right click context menu on a HTML Canvas?
Try this
canvas.oncontextmenu = function (e) {
e.preventDefault();
};
You can use this:
$('img').bind('contextmenu', function(e){
return false;
});
See this working example!
With the lastest jQuery:
$('body').on('contextmenu', 'img', function(e){ return false; });
Note: You should use something narrower than body
if possible!
Or without jQuery, applying on canvas:
canvas.oncontextmenu = function(e) { e.preventDefault(); e.stopPropagation(); }
EDITED
Updated the Fiddle Example to show the contextmenu being limited to the canvas and not the image.
JQUERY
$('body').on('contextmenu', '#myCanvas', function(e){ return false; });
HTML EXAMPLE
<canvas id="myCanvas" width="200" height="100">
Your browser does not support the canvas element.
</canvas>
<img src="http://db.tt/oM60W6cH" alt="bubu">
This will disable the context menu on the canvas.
<canvas oncontextmenu="return false;"></canvas>