Android webview不会加载页面,但会从浏览器加载应用程序 [英] Android webview does not load the page but app load from browser
问题描述
我有一个html 5移动网络应用程序从浏览器加载,但卡在Android webview上。我们在加载Web应用程序之前使用了启动画面,我的webview卡在启动画面中,没有加载主页。我们使用 wurfl api 通过用户代理检测设备,我确保用户代理是同样来自浏览器和webview,因为我们只使用操作系统名称和版本Android和3.9>。最近两天一直遇到这个问题。:
I have a html 5 mobile web app which load from browser fine but get stuck on android webview. We used a splash screen before loading the web app and my webview is stuck into the splash screen , does not load the home page. We are using wurfl api to detect device through user agent and i made sure the user agent is same from browser and webview as we are only going with OS name and version which is "Android" and "3.9>". Got stuck with this issue for last two days.:
String url = http://myapp.com
webView = (WebView) findViewById(R.id.webView1);
webView.getSettings().setJavaScriptEnabled(true);
progDailog = ProgressDialog.show(Activity.this, "Loading","Please wait...", true);
progDailog.setCancelable(false);
webView.setWebViewClient(new WebViewClient() {
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
progDailog.show();
view.loadUrl(url);
return true;
}
@Override
public void onPageFinished(WebView view, final String url) {
progDailog.dismiss();
}
});
webView.loadUrl(url);
是的我已经添加了互联网,wifi权限给Manifest:
Yes I have added the internet, wifi permission to Manifest:
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
获取例外:
webview : blockWebkitViewMessage= false (on Samsung galaxy s3)
(Nexus 5)
W/AwContents(15767): nativeOnDraw failed; clearing to background color.
I/chromium(15767): [INFO:async_pixel_transfer_manager_android.cc(56)] Async pixel transfers not supported
I/chromium(15767): [INFO:CONSOLE(2)] "Viewport argument key "minimal-ui" not recognized and ignored.", source:
推荐答案
关于通过在我的活动中添加此行来启用本地存储的问题。
It was issue about turning local storage on by adding this line to my activity.
webView.getSettings().setDomStorageEnabled(true);
这篇关于Android webview不会加载页面,但会从浏览器加载应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!