开发者

How to get text entered in html portion of Android WebView so that it can be processed by Android native code

开发者 https://www.devze.com 2023-02-16 20:40 出处:网络
I have an Android Webview application. How do I \"transfer\" the text entered into the html web page, e.g to a textfield, after the user click the \"submit\" button on the html web page, so that my An

I have an Android Webview application. How do I "transfer" the text entered into the html web page, e.g to a textfield, after the user click the "submit" button on the html web page, so that my Android native code can process the tex开发者_开发问答t ? Can it be done using javascript in the html code? I have looked at addJavaScriptInterface method in the WebView but I'm not sure if it's what I'm looking for.


Looks like it is unsafe to give such possibility to developers because they could steal some user authentication data with such ability. But you can give to JS ability to notify about data using addJavascriptInterface method http://developer.android.com/reference/android/webkit/WebView.html#addJavascriptInterface%28java.lang.Object,%20java.lang.String%29

0

精彩评论

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

关注公众号