extjssencha-architectsencha-cmd

disable right click in login page extjs not working


I want to disable right click on a login page in extjs to prevent pasting of credentials. No matter whatever i tried, it is not working. Any suggestions please


Solution

  • You have to listen to contextmenu on the body

           Ext.getBody().on('contextmenu', function(e) {e.preventDefault();});
    

    Remember to clear the listener, once you need it no longer.