开发者

How to find GO button keycode using Javascript [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.

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 question

Anyone 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);
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜