【发布时间】:2017-02-08 14:48:22
【问题描述】:
经过多次重定向后,url 最终出现在 Webform 中我如何退出 webview ? 有没有一种方法可以检测网页视图中的 Html 元素,例如页面中的按钮。我不能在这里使用 Javascript,因为我不拥有这些网站
public class ProductionWebView extends Activity{
private WebView webView;
String url ="https://www.google.lk/?gws_rd=ssl";
@SuppressLint("JavascriptInterface")
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.production_webview);
webView = (WebView) findViewById(R.id.webView1);
webView.getSettings().setLoadsImagesAutomatically(true);
webView.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY);
webView.loadUrl(url);
//ws.setJavaScriptEnabled(true);
webView.addJavascriptInterface(new Object()
{
public void performClick()
{
// Deal with a click on the OK button
}
}, "Next");
webView.addJavascriptInterface(new Object()
{
public void performClick()
{
}
}, "Authorize");
}
}
【问题讨论】:
标签: javascript android android-studio url webview