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

  • Home
  • SEARCH
  • 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
  • 0 Views
  • 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

Ask A Question

Stats

  • Questions 197k
  • Answers 197k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer mysql_set_charset() would be an option - but an option limited… May 12, 2026 at 7:17 pm
  • Editorial Team
    Editorial Team added an answer In settings.py: try: from local_settings import * except ImportError as… May 12, 2026 at 7:17 pm
  • Editorial Team
    Editorial Team added an answer It is a serialized version of an PHP array: <?php… May 12, 2026 at 7:17 pm

Related Questions

In my VC++ application I have an embedded browser (MSHTML). It works fine and
My WinForms application has a tab with a System.Windows.Forms.WebBrowser control. There are several controls
I am trying to create a form with webbrowser control. I am trying to
We have a windows application that contains an ActiveX WebBrowser control. As part of

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.