Display classic menu

Discussion in 'JavaScript' started by waitAMoment, Jul 16, 2013.

  1. #1
    Hi all,

    I had already developed the js code that allowed me to display the context menu through another action. For example, by left clicking or pressing a key.
    I managed to do what I wanted for most elements except for some like the mails in gmail or hotmail. When you right-click, there is a small menu with "archive" or "mark as unread" for example. It's not the classic menu which appears.
    What I would like to do is force the display of the classic menu on these too.
    Here is the code I have so far to generate my contextmenu event :
    var displayContextMenu = function(element, event)
    {
        var Event = element.ownerDocument.createEvent('MouseEvents');
     
        Event.initMouseEvent('contextmenu', true, true, element.ownerDocument.defaultView, 1, event.screenX, event.screenY, event.clientX, event.clientY, false, false, false, false, 2, null);
        element.dispatchEvent(Event);
    };
    Code (markup):
    With that, on an email in gmail for example I still have the special menu.
    Do you have any idea about how I could do ?
     
    waitAMoment, Jul 16, 2013 IP
  2. JoeSimmons

    JoeSimmons Greenhorn

    Messages:
    11
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    21
    #2
    You will have to find out what function they use to generate their own context menu. It will be pretty difficult, I'd imagine.
     
    JoeSimmons, Aug 10, 2013 IP