Thursday, July 26, 2007

Enabling the Default Internet Explorer Context Menu

In addition to running in Application Mode, Microsoft CRM modifies the standard Internet Explorer behavior by displaying its own context menu when you right-click in the application. Right-clicking a grid gives you options unique to Microsoft CRM, such as Open, Print, and Refresh List. However, right-clicking a form won't display a context menu like you would see on a normal Web page. When you're troubleshooting and debugging, you might find that you want to access the standard Internet Explorer context menu so that you can use features such as View Source, Properties, or Open In New Window. You can re-enable the Internet Explorer context menu by editing the Global.js file.
Re-Enabling the Internet Explorer Standard Context Menu
  1. On the Microsoft CRM Web server, navigate to \_common\scripts (typically C:\Inetpub\wwwroot\_common\scripts).

  2. Open the Global.js file in Notepad (or any text editor). Note: Do not double-click this file because it will attempt to execute the JavaScript file.

  3. Right-click the file, and then click Edit.

  4. Use your text editor's Find feature to locate the document.oncontextmenu() function.

  5. Comment out the existing code in this function by adding /* and */ as shown in the following code. You can undo this change later by simply removing event.returnValue = true; line and the comment characters.

    function document.oncontextmenu()
    event.returnValue = true;

    var s = event.srcElement.tagName;
    (!event.srcElement.disabled &&
    (document.selection.createRange().text.length > 0
    s == "TEXTAREA"
    s == "INPUT" && event.srcElement.type == "text"));

  6. Save the file.

  7. Open a page in Microsoft CRM and right-click it. You will see the familiar Internet Explorer context menu.


Use this technique on development servers only. Do not modify the Global.js file in a production or staging environment; this unsupported change might cause unpredictable behavior. Microsoft CRM prevents use of the right-click context menu for the user's benefit and also to maintain a predictable navigation structure in the application interface.

No comments: