我有一个非常基本WebView
的方法,直到我尝试添加一个webViewClient
停止处理 JavaScript 的自定义。难道我做错了什么?是否有另一种方法可以摆脱 WebView 中的地址栏和菜单选项?
browser = (WebView) findViewById(R.id.webkit);
WebSettings webSettings = browser.getSettings();
webSettings.setJavaScriptEnabled(true);
// uncommenting this line will remove address bar, but also stop JavaScript from loading
//browser.setWebViewClient(new InternalWebViewClient());
// even uncommenting this line will stop JavaScript from loading
//browser.setWebViewClient(new WebViewClient());
browser.setWebChromeClient(new InternalWebChromeClient());
if (savedInstanceState != null) {
browser.restoreState(savedInstanceState);
} else {
browser.loadUrl("http://site.with.javascript");
}