Disabling backspace in browsers when using event?

I’m creating a gui in three.js and building keyboard input.

However, whenever I press backspace, my browser goes back a page.

I’m using EDGE, however others may be the same too?

document.addEventListener("keydown", keyPress, false);

function keyPress(e){
  var keycode = e.keyCode;

  // ...
}

Any ideas how to disable the browser back?

function keyPress(e){
    var keycode = e.keyCode;
    e.preventDefault();
}

Event.preventDefault();

Thanks, but unless a html edit control is focused… it goes back a page.

window.addEventListener('keydown',e => {
  console.log(e.keyCode);
  if(e.keyCode === 8){//backspace
    e.preventDefault();
  }
});