window.oncontextmenu = function() {
return false;
};
Will this work on all major browsers such that the right click will not be initiated?
Definition and Usage. The oncontextmenu event occurs when the user right-clicks on an element to open the context menu. Note: Although the oncontextmenu event is supported in all browsers, the contextmenu attribute is currently only supported in Firefox.
The oncontextmenu attribute fires when the user right-clicks on an element to open the context menu. Note: Although the oncontextmenu event is supported in all browsers, the contextmenu attribute is currently only supported in Firefox. The oncontextmenu attribute is part of the Event Attributes, and can be used on any HTML elements.
The contextmenu event fires when the user attempts to open a context menu. This event is typically triggered by clicking the right mouse button, or by pressing the context menu key.
Once a context menu item has been added using contextMenus.create it's displayed in all browser tabs, but you can hide it by removing it with contextMenus.remove. The full list of supported contexts is available at menus.ContextType and includes contexts outside of a web page, such as bookmark items in the browser UI.
See this quirksmode page for a detailed compatibility table.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With