mozilla
Your Search Results

    mozbrowsercontextmenu

    This article is in need of a technical review.

    Non-standard
    This feature is not on a current W3C standards track, but it is supported on the Firefox OS platform. Although implementations may change in the future and it is not supported widely across browsers, it is suitable for use in code dedicated to Firefox OS apps.

    The mozbrowsercontextmenu event is fired when a browser <iframe> tries to open a context menu.

    General info

    Specification
    Non standard
    Interface
    CustomEvent
    Bubbles
    Yes
    Cancelable
    Yes
    Target
    <iframe>
    Default Action
    None

    Properties

    Property Type Description
    target Read only EventTarget The browser iframe
    type Read only DOMString The type of event.
    bubbles Read only boolean Does the event normally bubble?
    cancelable Read only boolean Is it possible to cancel the event?
    detail Read only Object A custom object

    Detail

    The detail property is an anonymous JavaScript object with the following properties:

    systemTargets
    An array of objects. This array contains some information regarding the dom tree traversed to check if there is a context menu. Each object with a src or href attribute is stored in the array as an object with two properties: nodeName, which is the name of the node traversed; and data, which value depends on the node's type: for <img>, <video>, or <audio> it's the value of the src attribute; for <a> and <area> it's the value of the href attribute.
    contextmenu
    An object representing the selected context menu items. Each <menu> element is represented as an object with a type property which has the value menu and an items property which is an array of objects representing its children elements. Each <menuitem> element is represented as an object with a type property which has the value menuitem and a label property which is a string that matches the <menuitem>'s label attribute. Note that all children of the root <menu> element also have an automatically generated id property.
    msg_name
    A string representing the type of event. For that event, it's always contextmenu.

    Example

    var browser = document.querySelector("iframe[mozbrowser]");
    
    browser.addEventListener("mozbrowsercontextmenu", function( event ) {
      console.log("Asking for menu:" + JSON.stringify(event.detail));
    });

    See also

    Document Tags and Contributors

    Contributors to this page: kscarfone, teoli, Jeremie
    Last updated by: teoli,