contextmenu, tell a user of available options with a data element like links , input etc. You have observed a list of options shown to you when you right click on a webpage like : “reload”, “view page source” etc, similarly when you right click a link, it show you options like : “open in new window”, “open in new tab” etc. These are the examples of contextmenu implemented by browser i,e they are default features of each browser. You can create your own context menu when needed in your application. Say you application is for managing image gallery, then you want, the right click to provide “copy”, “cut”, “save”, “downlaod” etc options on right click of a folder or image. A no of plugin are available there, to write custom contextmenu . some of them are listed below
for people working on Rubu on Rails, gems also available for developing contextmenu
Well, I have not tried any of the above plugin or gems, as my current requirement was not to set contextmenu, but to prevent it. I’ am working on financial domain website, and for security reason they do not want the user to access any contextmenu provided by the browser. So basically they want to disable right click on the page . It can be, achieved by the few lines of code. just put the below lines of code on page , you want to prevent the right click.
alert(“For Security Reason Right Click Disabled on This Page”)
Note that contextmenu is a event like click, mouseover , keydown etc. So, to prevent it we have just prevented its default behaviour. complete list of events is available here at the bottom of the page . contextmenu event is explained in detail here .