How to turn off the right-click functionality in Internet Explorer 5.0 or a later version by using FrontPage 2000

Article translations Article translations
Article ID: 286426 - View products that this article applies to.
This article was previously published under Q286426
Expand all | Collapse all

On This Page

SUMMARY

The following article describes how to use FrontPage 2000 to turn off the right-click functionality in Microsoft Internet Explorer versions 5.0 or a later version. These examples use JavaScript in an attempt to discourage users from saving copyrighted images to their computers.

NOTE: This article uses custom Dynamic Hypertext Markup Language (DHTML) that may not be available in all browsers.

For more information about this topic, click Microsoft FrontPage Help on the Help menu, type compatibility in the Answer Wizard, and then click Search to view the topic.


Microsoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific requirements.

How to Disable Right-Click Functionality

The following examples illustrate two methods for turning off (disabling) right-click functionality in a browser.

NOTE: You may receive an error message if you copy and paste the examples directly from this article into FrontPage. The angle brackets ("<" and ">") may appear as escaped HTML code ("<" and ">"). To work around this behavior, paste the script in a blank Notepad document, and then copy it from Notepad before you paste it into FrontPage.

Example #1: Turn Off the Shortcut Menu

  1. Open a new page in FrontPage.
  2. Switch to HTML view.
  3. Locate the opening <BODY> tag.
  4. Modify the <BODY> tag to resemble the following:
    <body onContextMenu="return false">
    					
  5. Preview the page in Internet Explorer 5.0 or later. When you attempt to right-click anywhere on the page, the shortcut menu is not displayed.

Example #2: Use JavaScript to Display a Warning Message

  1. Open a new page in FrontPage.
  2. On the Insert menu, click Advanced.
  3. Select HTML.
  4. Type the following JavaScript code into the HTML Markup box:
    <script language="JavaScript">
    
    var message = "Sorry, that function is disabled.\n\n";
    message += "This page is copyrighted, and ";
    message += "all content is protected."; 
    
    function click(e) {
      if (document.all) {
        if (event.button == 2) {
          alert(message);
          return false;
        }
      }
      if (document.layers) {
        if (e.which == 3) {
          alert(message);
          return false;
        }
      }
    }
    
    if (document.layers) {
      document.captureEvents(Event.MOUSEDOWN);
    }
    document.onmousedown=click;
    </script>
    					
  5. Click OK.
  6. Preview the page in Internet Explorer 5.0 or later. When you attempt to right-click anywhere on the page, a message box appears, stating that the contents of the page are copyrighted, and therefore the right-click function is turned off (disabled).

Additional Information

Microsoft Internet Explorer allows users to save Web pages and all embedded images to their computer's hard disk. The implementation of this article will not protect images or source code from being copied, but it will serve as a method for possibly deterring some Web users.




REFERENCES


For more information about Microsoft JScript, visit the following Microsoft Web site:
http://msdn2.microsoft.com/en-us/library/hbxc2t98(VS.71).aspx


Properties

Article ID: 286426 - Last Review: July 4, 2007 - Revision: 2.2
APPLIES TO
  • Microsoft Internet Explorer 5.5
  • Microsoft Internet Explorer 5.0
  • Microsoft Internet Explorer 5.5
  • Microsoft Internet Explorer 5.0
  • Microsoft Internet Explorer 5.5
  • Microsoft FrontPage 2000 Standard Edition
Keywords: 
kbprogramming kbdhtml kbscript kbhowtomaster KB286426

Give Feedback

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com