0

I want to edit the context menu. When I select any text and Press the right button then this will show up.

enter image description here

I want to edit this context menu. And add the new item into this. And the exsisting buttons will be same.

In that picture "Import CURL in postman" this is embaded by the postman extension. I want to do the same thing, adding an element to the context but cann't find any solution how to do this.

1 Answers1

0

if (document.addEventListener) {
  document.addEventListener('contextmenuclick', function(e) {
    alert("hello"); //here you draw your own menu
    e.preventDefault();
  }, false);
} else {
  document.attachEvent('oncontextmenuclick', function() {
    alert("inside context menu");
    window.event.returnValue = false;
  });
}
<body>
  Lorem ipsum...
</body>
  • As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Feb 26 '23 at 18:09