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.

Share:
13,508

Related videos on Youtube

David G
Author by

David G

[email protected]

Updated on June 26, 2022

Comments

  • David G
    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
      David G about 12 years
      No need to be a meany face ]:
    • Dennis
      Dennis about 12 years
      Not 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
      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
      namuol over 10 years
      Another legitimate use: Games.
  • David
    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 :)

Related