Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can we disable right clicking on Anchor Tag in HTML

I have a requirement where right clicking on document name in grid opens a customized context menu (using Smartgwt). I had to implement hyperlink so I created an anchor tag (which calls a JSNI method which in turn calls a GWT method and which again in turn calls an applet method to open a document and stream it to the server). If you don't right click on the document name everything works fine and custom context menu opens. But when you click on document name then the default link menu with open, open in new tab comes and due to clash between smartgwt context menu and this menu some Javascript Null Pointer Exception is thrown in my client console.

Now is there any way that I can hide the default link menu (on anchor tag) so that it doesn't appear in my grid even when anyone clicks on the document name?

like image 980
abhihello123 Avatar asked Sep 04 '12 07:09

abhihello123


1 Answers

by adding this to anchor tag you can disable right click oncontextmenu="return false"

like image 93
Gyan Chandra Srivastava Avatar answered Oct 14 '22 01:10

Gyan Chandra Srivastava