I am loading the content of a locally stored HTML file in a WebView in my app. This file also contains links inside it, which when clicked, load the URLs in the same WebView. I want to load these links in an external browser instead. I have taken a look at onPageStarted and shouldOverrideUrlLoading, but they don't seem to work. I have tried the following:
    webAbout = (WebView) findViewById(R.id.wvAbout);
    webAbout.loadUrl(Const.defURL);
    webAbout.setWebViewClient(new WebViewClient() {  
          @Override  
          public void onPageStarted(WebView view, String url, Bitmap favicon){  
            if (!url.startsWith(Const.defURL)) { 
              view.stopLoading();  
              // DO SOMETHING  
            }else{
                view.loadUrl(Const.defURL);
            }
          }  
        });
I have also tried:
    webAbout = (WebView) findViewById(R.id.wvAbout);
    webAbout.loadUrl(Const.defURL);
     webAbout.setWebViewClient(new WebViewClient(){
        public boolean shouldOverrideUrlLoading(WebView view, String url) {
            if (url != null && (url.startsWith(Const.defURL))){
                webAbout.loadUrl(Const.defURL);
                return true;
                } 
          else  {
                view.getContext().startActivity(
                new Intent(Intent.ACTION_VIEW, Uri.parse(url)));  
                return false;
          }
        }
    });
but in both cases, the WebView does not load anything. Any idea where I am going wrong?
 
     
     
     
     
    