How to find GO button keycode using Javascript [closed]
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
开发者_运维知识库 Improve this questionAnyone have idea, how to find GO button's keycode using Javascript in Android browser.
The 'Go', 'Enter/Return', 'Search', ... keys are all synonyms of KeyEvent.KEYCODE_ENTER The KeyboardView only changes its appearance based on EditText inputMethod options.
All result in the character 10 / 0x0A to be produced.
Note that it will be caught and interpreted by webview internal logic unless you catch it yourself by overriding onKeyDown in your activity.
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if((keyCode == KeyEvent.KEYCODE_ENTER)){
mWebView.loadUrl('javascript:handleEnterKey()');
return true;
}
return super.onKeyDown(keyCode, event);
}
精彩评论