How to disable the browser's right click menu?

  1. #1

    How to disable the browser's right click menu?

    Is there a way to turn off the default browser's right click context menu? The reason is that I won't have a Coolite context menu everywhere and I don't want the end user to be able to right click and get the browser's right click menu. I have seen this done before, so I'm sure it can be done.
  2. #2

    RE: How to disable the browser's right click menu?

    Generally I would tend to try and avoid disabling the browsers default contextmenu functionality, but if you insist, you could make it happen as follows.

    Add the following <script> somewhere within the <body> of your Page.

    Example

    <script type="text/javascript">
        Ext.onReady(function () {
            Ext.get(window.document).on('contextmenu',function (e) {
                e.preventDefault();
                return false;
            });
        });
    </script>
    Or, add the following <Listener> to your <ext:ScriptManager>

    Example

    <ext:ScriptManager ID="ScriptManager1" runat="server">
        <Listeners>
            <DocumentReady Handler="
                    Ext.get(window.document).on('contextmenu', function (e) {
                        e.preventDefault();
                        return false;
                    });" 
                />
        </Listeners>
    </ext:ScriptManager>
    Hope this helps.

    Geoffrey McGill
    Founder

Similar Threads

  1. [CLOSED] How to disable whole CycleButton with menu by javascript?
    By leon_tang in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: May 17, 2012, 12:28 PM
  2. Replies: 2
    Last Post: Feb 22, 2012, 4:16 PM
  3. open new browser tab by click on grid view
    By vahid.ch in forum 1.x Help
    Replies: 1
    Last Post: Dec 19, 2011, 8:36 AM
  4. how to open new browser when i click button
    By Dinesh.T in forum 1.x Help
    Replies: 4
    Last Post: Mar 24, 2010, 3:48 AM
  5. Set disable menu commands
    By DGil in forum 1.x Help
    Replies: 2
    Last Post: Jun 19, 2009, 8:13 AM

Posting Permissions