How to prevent back button on mobile devices on browser

Is there a way to detect the back button on mobile devices (beside the home button) on any browser?
I am using Cocos Creator 2.4.3, and scripting with Javascript

I do have remote debugging on Chrome set up for easy access to console logs on mobile

Every method I’ve tried so far can’t detect the back button on my mobile device (Samsung Galaxy A5), when I press the back button, it will either:

  • exit out of an Edit Box
  • exit fullscreen
  • go back to previous webpage

So far, I have tried using:

cc.systemEvent.on(cc.SystemEvent.EventType.KEY_DOWN, function (event) {
    console.log(event.keyCode);
}, this);

this, from here

cc.eventManager.addListener({
event: cc.EventListener.KEYBOARD,
onKeyPressed: function(keyCode, event) {
console.log(keycode);
console.log(event);
if (keyCode === cc.macro.KEY.back) {
event.preventDefault();
alert(“Back button pressed!”);
self.versionLabel.string == “Back button pressed!”;
}
}
}, this.node);

this:

    document.addEventListener("keydown", function (e) {
        console.log(e);
        e.preventDefault();
    });

this, from here (I also tried using “deviceready” with this and changing true to false)

    document.addEventListener("backbutton", function (e) {  //"backbutton" (document event listener, cant detect )
        console.log(e);
    }, true); 

this, from here

    window.addEventListener("hashchange", function(e) {
        alert("hash change!");
        console.log("hash change!@");
        console.log(e);
    });

and this, from here

    var mKeyboardListener = cc.EventListener.create({
        event: cc.EventListener.KEYBOARD,
        onKeyReleased: function(keyCode, event) {
            console.log(keyCode);
            console.log(event);
        }
    });
    cc.eventManager.addListener(mKeyboardListener, 1);

If I missed something somewhere in one of these ways, or there is another way of detecting the back button, please reply.