Is oncontextmenu cross browser?
13,508
Solution 1
See this quirksmode page for a detailed compatibility table.
Solution 2
QuirksMode has a comprehensive chart of support for the event. You can use it to decide if it meets your needs depending on browsers you support.
Related videos on Youtube
Comments
-
David G over 1 year
window.oncontextmenu = function() { return false; };
Will this work on all major browsers such that the right click will not be initiated?
-
David G about 12 yearsNo need to be a meany face ]:
-
Dennis about 12 yearsNot everything is intrinsically good or intrinsically bad. Disabling the context menu may be just what the OP needs for the situation. I've done this to provide a custom menu for some elements. You can't make blanket statements without context.
-
Pekka about 12 years@Dennis you're right, we don't know what David is doing so snarky comments are a bit premature. But 95% of the people who ask this on SO want to block the right click on a normal web site, which is a terrible thing to do. Still, I didn't mean to be mean :)
-
namuol over 10 yearsAnother legitimate use: Games.
-
-
David about 12 years+1 for being professional enough to separate helpful content (answer) from opinion (comment), even though I think the latter is more important in this particular case :)