It's great that it's possible to test many cases in a Cordova/Ionic app in the browser. But I haven't yet found a way to fake pressing Android's (formerly hardware-) back-button.
Would be nice to have an extra drawer with a back-button or a key combination (e.g. Alt+Ctrl+<) which triggers an event that makes Ionic think the Android back-button was pressed.
Is it possible to trigger such event with JavaScript? How?
To be clear: I only want this when testing ionic apps in my web-browser. So you Android guys: no need to provide Java code here - we're not on an Android device or emulator. And: I'm pretty sure something like $ionicHistory.goBack()
or $window.history.back()
is not what I want.
I have a working solution I'd like to share with you. When pressing
Alt+Ctrl+<
it triggers thebackbutton
event. Of course such things likenavigator.app.exitApp()
won't work, but simple navigation works, e.g. closing modals.