Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 61511
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T18:19:50+00:00 2026-05-10T18:19:50+00:00

The WebBrowser control has a property called IsWebBrowserContextMenuEnabled that disables all ability to right-click

  • 0

The WebBrowser control has a property called ‘IsWebBrowserContextMenuEnabled’ that disables all ability to right-click on a web page and see a context menu. This is very close to what I want (I don’t want anyone to be able to right-click and print, hit back, hit properties, view source, etc).

The only problem is this also disables the context menu that appears in TextBoxes for copy/paste, etc.

To make this clearer, this is what I don’t want:
badcontext

This is what I do want:
goodcontext

I would like to disable the main context menu, but allow the one that appears in TextBoxes. Anyone know how I would do that? The WebBrowser.Document.ContextMenuShowing event looks promising, but doesn’t seem to properly identify the element the user is right-clicking on, either through the HtmlElementEventArgs parameter’s ‘FromElement’ and ‘ToElement’ properties, nor is the sender anything but the HtmlDocument element.

Thanks in advance!

  • 1 1 Answer
  • 1 View
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-10T18:19:51+00:00Added an answer on May 10, 2026 at 6:19 pm

    have you considered writing your own context menu in javascript? Just listen to the user right clicking on the body, then show your menu with copy and paste commands (hint: element.style.display = ‘block|none’). To copy, execute the following code:

       CopiedTxt = document.selection.createRange();    CopiedTxt.execCommand('Copy'); 

    And to paste:

       CopiedTxt = document.selection.createRange();    CopiedTxt.execCommand('Paste'); 

    Source:

    http://www.geekpedia.com/tutorial126_Clipboard-cut-copy-and-paste-with-JavaScript.html

    NOTE: This only works in IE (which is fine for your application).

    I know its not bulletproof by any means, but here is a code sample that should get you started:

    <html>     <head>         <script type = 'text/javascript'>             var lastForm = null;             window.onload = function(){                  var menu = document.getElementById('ContextMenu');                 var cpy = document.getElementById('CopyBtn');                 var pst = document.getElementById('PasteBtn');                  document.body.onmouseup = function(){                     if (event.button == 2)                     {                         menu.style.left = event.clientX + 'px';                         menu.style.top = event.clientY + 'px';                         menu.style.display = 'block';                          return true;                     }                      menu.style.display = 'none';                 };                  cpy.onclick = function(){                     copy = document.selection.createRange();                     copy.execCommand('Copy');                     return false;                 };                  pst.onclick = function(){                     if (lastForm)                     {                         copy = lastForm.createTextRange();                         copy.execCommand('Paste');                     }                     return false;                 };             };         </script>     </head>      <body oncontextmenu = 'return false;'>         <div id = 'ContextMenu' style = 'display : none; background: #fff; border: 1px solid #aaa; position: absolute;             width : 75px;'>             <a href = '#' id = 'CopyBtn' style = 'display: block; color : blue; text-decoration: none;'>Copy</a>             <a href = '#' id = 'PasteBtn' style = 'display: block; color : blue; text-decoration: none;'>Paste</a>         </div>         sadgjghdskjghksghkds         <input type = 'text' onfocus = 'lastForm = this;' />     </body> </html> 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using the webBrowser control to surf to a page that has an Iframe.
I have a winforms c# app that has an embedded webbrowser control inside it
is there a way to know that the WebBrowser control has finished loading the
I have a page that contains a WebBrowser control that is frequently updating content.
am trying to convert this c# to vb.net that has a webbrowser control, but
I have a page that contains a WebBrowser control that is frequently updating content.
I need to catch keypresses in my C# program that has a WebBrowser control
Unlike say a RichTextBox control which has a enum ScrollBars property, the WebBrowser control
i have found that WebBrowser control (both Winforms and WPF) has certain javascript constructs
I have a C# WinForms application that has a WebBrowser control inside of it.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.