I’m using Ionic 1.2.1 to create an app that works both as an Android/iOS Cordova app and as a mobile website. Kudos to the Ionic team for doing such a great job making that possible! However, I’m trying to handle the Android hardware back button and I have code in a controller that works great in the mobile app, but doesn’t work at all in Chrome for Android. This is the basic code:
document.addEventListener(‘backbutton’, function() {
// code here
});
The code inside the listener function doesn’t execute at all in Chrome. If I wrap all of this in an event listener for the ‘deviceready’ event, that also doesn’t execute at all. It seems like these two events just don’t happen in Chrome (though they do in the Cordova app).
Does anyone know of a way to handle the hardware back button in plain old Chrome?