I’m a fairly active member of the programming Q&A site stackoverflow.com; I often come across questions regarding web development, along the lines of:
How do you disable the browser’s context menu?
How do you prevent the user clicking so-and-so menu item.
(In fact, I answered a question like this here).
This is all wrong, for three main reasons:
- It undermines the privileges that browsers give.
- It makes your application harder for the user to use.
- Users want to control how their browsers work, not you.
The point of web browsers in regards to the scripts that run in them is that it is essentially a sandbox. The scripts don’t have any control of anything outside the browser window they are running in (except for perhaps setting cookies and the likes), and this is the way it should be. Therefore trying to change this defeats the purpose of the browser of a moderator over what the page can do to the user’s computer.
“Aha!”, they say, “We can handle mouse events and return false!” This is completely wrong. To me, one of the most important features of software development is usability. You can have the most sleek design, the most killer algorithm, but with a poor user interface and workflow, these become irrelevant. And one of these key usability features is consistency. Users want to visit websites, and have a consistent experience between them. This is mainly down to the fact that they do not have to learn anything new, because they have experienced similar interfaces and workflows before. This means that they can focus on the content and meaning of the application, rather than being diverted from this to work out how to use the thing. If you go about changing the core operation and functionality of the browser, you change this experience, and begin to alienate your users from what they expect.
Furthermore, users should be able to choose how to use their browser. If they want a context menu, let them have it. Most of these features also apply to power users, and they like their applications to behave exactly how they want, not how the developer wants. You don’t control their browser. They do.
At the end of the day, this will only hurt you. Users will have a bad experience with your software, and will end up not using it again, and may even let others know of the bad experiences that they have had, which reflects negatively upon your company as a whole.
However, some people then go onto say “But I need my application to do this”. If it is imperative that your application behaves in a way that your browser would not normally, you are using the wrong platform. Switch over to a platform where what you want to achieve is more common, and make your users feel comfortable and familiar with the context that they are working under.