I have a button underneath a WebView. When I click on it I want a javascript of run on the WebView.
This doesn't work:
public void onClick(View v) {
String script = "javascript:document.getElementById('lnkNxtPg').click()";
switch (v.getId()) {
case R.id.nextPg:
webView.loadUrl(script);
break;
default:
break;
}
}
but this works:
public void onClick(View v) {
switch (v.getId()) {
case R.id.nextPg:
webView.loadUrl("www.google.com");
break;
default:
break;
}
}
How can I make the first example work?
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.