javascript - How to prevent default right click on canvas containing image -


i have canvas , display image inside it. have attached jquery event it, this:

$("#mycanvas").mousedown(function(e) {     //do     e.preventdefault();     e.stoppropagation(); }); 

i expect code operations , prevent default browser behavior. former fulfilled, however, latter, namely, default behavior prevention not happen. event runs though. wonder how prevent showing menu can see on image upon right-click:

enter image description here

you can use contextmenu:

$("#mycanvas").contextmenu(function(e) {     //do     e.preventdefault();     e.stoppropagation(); }); 

Comments

Popular posts from this blog

magento2 - Magento 2 admin grid add filter to collection -

Android volley - avoid multiple requests of the same kind to the server? -

Combining PHP Registration and Login into one class with multiple functions in one PHP file -