@Override
 public boolean onKeyDown(int keyCode, KeyEvent event) {
   if (keyCode == KeyEvent.KEYCODE_BACK && mWebView.canGoBack()) {
     mWebView.goBack();
     return false;
   }
   return super.onKeyDown(keyCode, event);
 }
 @Override
 public void handleMessage(Message msg) {
   if (msg.what != 200) { // 主页不存在
     // 载入本地assets文件夹下面的错误提示页面404.html
     mWebView.loadUrl("file:///android_asset/404.html");
   } else {
     mWebView.loadUrl(Url);
   }
 }
  @Override
  protected void initView() {
    setNav(R.drawable.ic_menu_back);
    mWebView = (MyWebView) findViewById(R.id.webview);
    mWebView.setWebChromeClient(
        new WebChromeClient() {
          @Override
          public void onReceivedTitle(WebView view, String title) {
            setTitle(title);
            super.onReceivedTitle(view, title);
          }

          @Override
          public void onProgressChanged(WebView view, int newProgress) {
            if (mProgressBar != null) {
              mProgressBar.setProgress(newProgress);
              int visible = newProgress == 100 ? View.INVISIBLE : View.VISIBLE;
              mProgressBar.setVisibility(visible);
            }
            super.onProgressChanged(view, newProgress);
          }
        });
    mWebView.setWebViewClient(
        new WebViewClient() {
          @Override
          public boolean shouldOverrideUrlLoading(WebView view, String url) {
            view.loadUrl(url);
            return super.shouldOverrideUrlLoading(view, url);
          }

          @Override
          public void onReceivedError(
              WebView view, WebResourceRequest request, WebResourceError error) {
            mWebView.setVisibility(View.INVISIBLE);
            view.stopLoading();
            view.loadUrl("file:///android_asset/404.html");
            super.onReceivedError(view, request, error);
          }

          @Override
          public void onPageFinished(WebView view, String url) {
            super.onPageFinished(view, url);
          }
        });

    mWebView.setDownloadListener(
        new DownloadListener() {
          @Override
          public void onDownloadStart(
              String url,
              String userAgent,
              String contentDisposition,
              String mimetype,
              long contentLength) {
            if (!StringUtils.isNullOrEmpty(url)) {
              Uri uri = Uri.parse(url);
              Intent intent = new Intent(Intent.ACTION_VIEW, uri);
              startActivity(intent);
            }
          }
        });
    mProgressBar = (ProgressBar) findViewById(R.id.progressbar);
  }