webView.setWebChromeClient(new WebChromeClient() {
@Override
public void onReceivedTitle(WebView view, String title) {
if (title != null) {
if (title.contains("404")) {
//加载错误显示的页面
showErrorPage();
} else {
//title为webview标题内容
tvTitle.setText(title);
}
}
super.onReceivedTitle(view, title);
}
});