How to cancel backspace key from navigating back…

Don’t ask me who had the insane idea that one can navigate back when pressing the back space.

In GWT we did something like that to cancel the backspace back navigation:

3 thoughts on “How to cancel backspace key from navigating back…”

  1. Cool, this improves usablilty.

    But, if the focus is set to something else than the body, it will not work. So, I think, it will be better to define, where the backspace is allowed and where not.

    if (as.getTagName().toLowerCase().equals(“input”) ||
    as.getTagName().toLowerCase().equals(“textarea”)) {
    // Backspace allowed
    } else {

    What do you think?

  2. Thanks for this nice part of code :)

    I changed a little bit and it works for me very nice. Here is my changes:

    Element as =;

    boolean readOnly = as.getPropertyBoolean(“readOnly”);
    boolean contentEditable = as.getPropertyBoolean(“isContentEditable”);
    if (readOnly || !contentEditable) {

Leave a Reply

Your email address will not be published. Required fields are marked *