WebSettings webSettings = mWebView.getSettings();
webSettings.setUseWideViewPort(true);
webSettings.setJavaScriptEnabled(true);
mWebView.setWebChromeClient(new WebChromeClient());
webSettings.setGeolocationEnabled(true);
webSettings.setJavaScriptCanOpenWindowsAutomatically(true);
mWebView.setWebChromeClient(new WebChromeClient() {
public void onGeolocationPermissionsShowPrompt(String origin, GeolocationPermissions.Callback callback) {
callback.invoke(origin, true, false);
}
});
mWebView.loadUrl("http://www.notifyweather.net23.net/");
Javascript将无法在某些手机中运行 log cat显示以下错误:
INFO:CONSOLE(10)]“未捕获的ReferenceError:getWeather不是 定义“,来源:http://www.notifyweather.net23.net/js/weather.js (10)