Search code examples
jquerydojoxpageslotus-domino

Prevent backspace button from navigating back to previous XPage


In my XPages application, I have noticed that whenever I hit the backspace key (without an input field having focus), the application returns to the previous XPage. How can I disable this behavior? I believe this is possible with JQuery and / or Dojo but am unsure how to add the code to an XPage? Also, could preventing this behavior have any impact on performance?


Solution

  • Dojo version to prevent Esc to close xPage tab in client. Guess you can use something similar for your problem as well.

    <xp:eventHandler
            event="onClientLoad"
            submit="false">
            <xp:this.script><![CDATA[dojo.addOnLoad( function(){ 
     dojo.connect( document, 'keydown', function(e){  
             if(e.keyCode === 27){ dojo.stopEvent(e); }        
     });
    });]]></xp:this.script>
        </xp:eventHandler>