Why does my BackSpace key take me back to previous page

Version 1

    Verified Product Versions

    Wavelink Naurtech CETerm 5.7

    Here is a simple scenario. You access a web page form which has an input field on it. You key in data, like “11111”. When you press the Backspace key, the numbers are removed one by one. Now if tap on a different part of the screen to take the focus away from the input field and press the Backspace key, you navigate back one page.

     

    This is because the "Back Navigation" on Backspace is a native behavior of the Microsoft browser control. Because of this, it is difficult to control by using OnKey META tags or CETerm key remapping.

     

    You can use this snippet of Javascript which will prevent the Backspace navigation behavior. This is a document level event handler. It will need to be included in every web page which requires this behavior.

     

    NOTE: This code will not work on Windows Mobile platforms. It will only work with CE .NET platform devices

     

    <script for="document" event=onkeydown>

     

     

    // Check if this is a Backspace

    if (window.event.keyCode == 8)

    {

        // Cancel backspace if not in a text element

       if(document.activeElement.type != "text")

        {

            window.event.returnValue=false;

        }

    }

    </script>