Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Overriding the right-click context menu in web browsers - pros and cons

Tags:

We are programming a web application (not 'just' a web site, but functionality-wise a real application), and have the following discussion for the next release:

  • our UI designer wants to replace the browser's right-click context menu (showing our own menu where appropriate, or no menu at all) because he wants the web app to be more like our (existing) Windows app
  • our developers (and I) strongly object because this is bad practice, and simply something you do not do in a web application

Thus, I'm looking for "more solid" arguments - like best practice guidelines, any statements from reputable sources, coding arguments etc. - for the pros and cons of this issue, which I can hopefully use to resolve it once and for all...

like image 496
ISW Avatar asked Mar 17 '09 14:03

ISW


2 Answers

You can't do that reliably anyway. In Firefox, go to Settings, Contents, JavaScript/Advanced (I'm guessing the captions, no English Firefox (; ) to override context menu behaviour and bang, your app doesn't work anymore. My online-banking application did this in their old version, so I couldn't do copy & paste with the mouse. I hated it, so I enabled the protection in Firefox and it worked. Kind of. Their new version doesn't do such bad things anymore.

Instead, use a little drop-down arrow where a context menu is needed, that can either be clicked or just hovered over to show the menu. JetBrains' TeamCity web app does that very well.

like image 165
OregonGhost Avatar answered Nov 14 '22 10:11

OregonGhost


If your application is to run in an intranet, maybe the UI designer arguments are valid: as long as all of the users of the application are well known and you want to emulate some Windows application, I think it's ok to restrict the right-click or any other input, because it's just the requirements of this application, as it would be to any other app.

But if your application is to run in the internet, disabling or replacing right-click is a very bad idea, and these are only some of the arguments I reminded of:

  • First of all, changing the behavior of the user interface is aggressive and annoying -- no one wants to get used to "new controls" just to access your site, and generally people hate to leave their comfort area. I mean, I know what my right click does and I want it to do always the same thing.

  • People can understand the difference between Windows apps and web apps, so there's no need to "emulate Windows app behavior".

  • Not everyone uses Windows :-)

  • Also, this is innefective, sice there are several ways to overwrite this behavior, such as settings in Firefox or even plugins that disable specific javascript instructions, such as this one.

like image 40
Paulo Guedes Avatar answered Nov 14 '22 09:11

Paulo Guedes