I am showing a new registration form(javascript page) consisting of 3 pages on android webview and then on 4th page on button click inside javascript page, I compute something and pass some data from android to webview.
The problem is when I send data to webview page from android, it changes the state of the webview and all the previous form data gets erased.
I am passing data from android to javascript page like below:
webView.evaluateJavascript("javascript:getData(" + data + ")",null);
I think this line reloads the webpage again but I am not sure.
Can anyone tell how can I achieve this without changing the state of webview? Any help would be much appreciated. Thanks
不要在evaluateJavascript()
中使用javascript:
方案,只需传递您要执行的实际 JS。
webView.evaluateJavascript("getData(" + data + ")", null /* callback */);
you can just do
webView.loadUrl("javascript:getData('" + data + "')");
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.