【发布时间】:2016-10-28 16:46:56
【问题描述】:
我有一个简单的 WebView 用于加载一些 URL。 页面开始加载(index.html、css 文件等 - 我可以在我的 apache 访问日志中看到它) 然后android显示这个错误:
10-28 19:38:17.948 18990-18990/com。 I/chromium:[INFO:CONSOLE(376)]“错误”,来源:http://**************** (376)
所以我在 WebViewClient 中添加了一个错误处理程序,如下所示:
public void onReceivedHttpError(WebView view, WebResourceRequest request, WebResourceResponse errorResponse) {
logger.e("Failed to open page: "
+ errorResponse.getReasonPhrase() + " "
+ request.getUrl().toString());
}
我在 logcat 中看到了这个:
10-28 19:41:28.678 19506-19506/com.mycompany.myapp E/XXXX xxx.xxx.MyWebViewClient: Failed to open page: Not Found http://xxxxxx/favicon.ico
即使图标丢失,相同的 URL 也可以在桌面上正常打开...有没有办法让 WebView 忽略某些错误?
【问题讨论】:
-
你解决过这个问题吗?
标签: error-handling android-webview favicon