title: Android WebView http links opens Chrome browser with 2 tabs to same url
body: <p>I've got a WebView in my app which displays a local html file. There are links to PDF files within it which I am handling on the shouldOverrideUrlLoading() method, but by doing so, the http:// links on the page are now being loaded in the WebView and not in the browser of the device.</p>
  
  <p>The code below recognises the pdf files and this works fine, but when I click on an external url, it opens two tabs in the chrome browser to the same url. How can I only open the one?</p>
  
  <pre><code>private class MyWebViewClient extends WebViewClient {
      @Override
      public boolean shouldOverrideUrlLoading(WebView view, String url) {
          if (url.contains(".pdf")) {
              // Remove the file:///android_asset/ text in url
              String tmpUrl = url.replace("file:///android_asset/", "");
              PdfHandler pdf = new PdfHandler(mContext);
              pdf.openPdf(tmpUrl);
              return true;
          }
          else{
              // Otherwise, the link is not for a page on my site, so launch another Activity that handles URLs
              Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
              startActivity(intent);
              return true;
          }
      }
  }
  </code></pre>
  
  <p>Thanks</p>