Android has hardware back and menu buttons.
It's a menu button similar to the Chinese character "san" on the right side of the home button.
Is it possible to control the behavior when this menu button is clicked?
The Back button was listed on the website below.
http://ja.onsen.io/guide/overview.html#HandlingBackButton
Is it possible to do something similar with the menu button?
Please let me know if anyone knows anything.
Thank you for your cooperation.
Cordova (checked in 6.1.1) has an event called menuutton
and captures it.
navigator.app.overrideButton("menubutton", true);
document.addEventListener("menubutton", function(){
alert("Hello Menu!");
}, false);
navigator.app.overrideButton
is required, but the document does not mention navigator.app
.It's a bug.
Note:
In the old Cordova, there was bug that prevented menubutton events from occurring in the first place.
If you want to continue using the old Cordova, you have to give up or fix CordovaWebViewImpl.java
and CoreAndroid.java
yourself.
Affected commit: https://github.com/apache/cordova-android/commit/b6a329d479e15cdf8a7a30a8fea9c5799c73841a
© 2025 OneMinuteCode. All rights reserved.