On Microsoft Edge, as a developer who runs a website, how do I disable the menu that appears when a visitor selects text?

Anon Dev 20 Reputation points
2024-01-22T22:57:23.1266667+00:00

I have searched around exhaustively for the answer to this question but can't find any documentation on it.

Preface: In browsers, when you right click on a website, you get the right click context menu. As a developer on a website, this can be disabled if I add an event listener for "contextmenu" and e.preventDefault()

However, Microsoft Edge has a second menu that appears when you select text. This appears to be unique to Microsoft Edge. And I have not found any method to disable this functionality on my website to visitors.

I would appreciate more information from the Microsoft Edge team on how to do this.

Microsoft Edge | Microsoft Edge development
0 comments No comments
{count} votes

Accepted answer
  1. Wenying Lu-MSFT 2,090 Reputation points Microsoft External Staff
    2024-01-23T08:22:09.8966667+00:00

    Hi @Anon Dev ,
    If you don't need to use this feature in Edge, you can disable this menu via specific setting in Edge.
    Just navigate to edge://settings/appearance, scroll down the page to the Context menus section and disable "Show mini menu when selecting text"
    In addition, you can disable this feature on specific sites, depending on your needs.
    Also, you could use window.onmouseup = event => event.preventDefault(); to customize the behavior of the mouse events.


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.
    Best Regards,
    Wenying Lu

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.